;

# C# Program to Check the Given Number is Armstrong Number or Not

###### Tutorialsrack 11/08/2019 C# Programs

In this C# program, we will learn how to write a program to check the given number is Armstrong Number or Not.

## What is an Armstrong number?

An Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits.

For Example,  153 is an Armstrong number.
(1)3 + (5)3 + (3)3= 153.

Here is the code of the program to check the given number is Armstrong Number or Not:

##### Code - C# Program To Check the Given Number is Armstrong Number or Not
``````using System;

namespace TutorialsrackPrograms
{
class Program
{
//C# Program to Check the Given Number is Armstrong Number or Not.
static void Main(string[] args)
{
int number, rem, sum = 0, temp;
Console.Write("Enter The Number: ");
temp = number;
while (number > 0)
{
rem = number % 10;
sum = sum + (rem * rem * rem);
number = number / 10;
}
if (temp == sum)
{
Console.Write("Given Number is an Armstrong Number.");
}
else
{
Console.Write("Given Number is not an Armstrong Number.");
}
}
}
}``````
##### Output

Enter The Number: 371
Given Number is an Armstrong Number.

Enter The Number: 652
Given Number is not an Armstrong Number.