What is an Armstrong Number
In number theory, a narcissistic number or “Armstrong number” is a number where in a given number base b is a number that is the sum of its own digits each raised to the power of the number of digits. This definition is way more complicated than it actually is. Check out this example
Example for an Armstrong number
The first image shows an Armstrong number.
The second image shows a number that is not an Armstrong number.
List of Armstrong numbers between 1 and 100000
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748
The largest known Armstrong number is
C# Program to check if a number is an Armstrong number
- Create a new project in the visual studio 2019.
- Select the C# Project Template – [ Console App .NET Framework]
- Configure your new project with a name “Armstrong”, set location, and solution file with a name “Armstrong”.
- When a new project created automatically generated with the basic structure of the program.
Advanced Version of a C# Programm for the Amstrong Number
Here we add few code lines to see what actually happens.
Summary for Armstrong Number with C#
Now you see how the Armstrong number works, and how you can write a C# Programm that checks if a given number is an Armstrong Number, or not.