C Program to check whether given Integer is Armstrong or Not
Sample Input 1 :
370
Sample Output 1 :
ArmStrong (3*3*3 + 7*7*7 + 0=370)
Note: Cube digits for 3 digit numbers, square digits for two digit number and soon.
Flow Chart Design
Program or Solution
#include<stdio.h>
int main()
{
int n,num,count,rem,i,m,k=0;
scanf("%d",&num);
n=num;
while(num!=0)
{
num/=10;
count++;
}
num=n;
while(num!=0)
{
rem=num%10;
m=1;
for(i=1;i<=count;i++)
{
m*=rem;
}
k+=m;
num=num/10;
}
if(n==k)
{
printf("Armstrong Number");
}
else
{
printf("Not ArmStrong Number");
}
return 0;
}
Output

Program Explanation
refer video tutorialComments
Related Programs
- C Program to check whether the given digit is occurred in a Number
- C Program to count the occurence of digit
- C Program to find the first digit of a number
- C Program to Count the digits in the given number.
- C Program to calculate sum of digits.
- C Program to calculate product of digits.
- C Program to reverse the digits of an number
- C Program to check whether given Integer is Palindrome or Not
coming Soon
coming Soon