Here we gave easiest understanding program to you.
All programs easy to learn every person.
And all subjects are compulsory in BCA.
Powered by Blogger.

Followers

Tuesday, 17 September 2019

Armstrong number in C

0 comments

/* C Program to verify given no. is Armstrong or not */




#include<stdio.h> 
int main() 
{  
int n,r,sum=0,m; 
printf("Enter a no:");  scanf("%d",&n);    m=n;  
while(n>0)
 {
    r=n%10;  
    sum=sum+r*r*r;  
    n=n/10;
 }
if(sum==m)
printf("Armstrong");  else
printf("Not Armstrong");
return 0;
}
 INPUT/OUTPUT:
Enter a no:153
Armstrong

No comments:

Post a Comment