➽ Program:-
#include<stdio.h>
#include<math.h>
int main()
{
int num, sum = 0,
rem, cube = 0, temp;
printf("Enter a
Number: ");
scanf("%d", &num);
temp = num;
while(num != 0)
{
rem = num % 10;
cube = pow(rem, 3);
sum = sum + cube;
num = num / 10;
}
if(sum == temp)
printf ("%d is an Armstrong No", temp);
else
printf ("%d is not an Armstrong No", temp);
}
➽ Output:-
Enter a Number: 371
371 is an Armstrong No
Enter a Number: 1600
1600 is not an Armstrong No
0 Comments
Please do not enter any spam link in the comment section.