#include<stdio.h>
int add(int);
int main()
{
int a,sum=1,c,d;
printf("enter a number \n");
scanf("%d",&a);
sum=add(a);
if(sum==a)
printf("entered number is armstrong number");
else
printf("entered number is not armstrong number");
}
int add(int a)
{
int rem,sum=0;
while(a!=0)
{
rem=a%10;
a=a/10;
sum=sum+(rem*rem*rem);
}
}
aditya_10 0 Newbie Poster
tinstaafl 1,176 Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.