Answer :
#include<stdio.h> //header file contains the function,decleraction and macro defination of key words used in code.
int main ()
{
int num,result=0,num1,num2; //adressing the variables
printf("Enter the digits "); //output
scanf("%d",&num);
num2=num;
while (num!=0)
{
num1=num%10; // it will store the last number
result=result+num1*num1*num1; //it will add it
num=num/10; // it will remove the last digit
}
if (result==num2)
{
printf("%d is a Armstrong number",num2); //output
}
else
{
printf("%d is not a Armstrong number",num2); //output
}
}
Output :
0 Comments