Program to accept a number and check the given number is Armstrong or not - 100 Most Important C# Programs

100 Most Important C# Programs

9. Program to accept a number and check the given number is Armstrong or not.

Code:

# include <stdio.h>

# include <conio.h>

main( )

{

int n, a, b, c, d;

clrscr( );

printf (“ Enter a Three Digit Number: “);

scanf (“%d”, &n);

a=n/100;

b=((n/10)%10);

c=n%10;

d=a*a*a*+b*b*b +c*c*c;

if (n= =d)

printf (“The Given Number is Armstrong

number”);

else

printf (“The Given Number is Not

Armstrong number”);

getch( );

}