C Program to accept a number & check the given number is Armstrong or not

CWC
1 Min Read

C Program to accept a number & check the given number is Armstrong or not

# 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( );
}

 

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version