WAP to Check Whether the Given Number is an Armstrong Number .
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#include<stdio.h> #include<math.h> int main() { int a,b,r,sum; sum=0; printf("Enter the number = "); scanf("%d",&a); b=a; while(a!=0) { r=a%10; a=a/10; sum=sum+(r*r*r); } if(sum==b) { printf("\nIt is an armstrong number \n"); } else { printf("\nIt is not a armstrong number\n "); } }
WAP to Check Whether the Given Number is an Armstrong Number .
Reviewed by Unknown
on
03:37
Rating:
No comments: