C Program to find number is armstrong number or not - c programs
// write a c program to find number is armstrong number or not
// check / print number is armstrong number or not
Armstrong number:
An Armstrong number is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong
/C Program to find / check / print number is armstrong number or not
#include<stdio.h>
int main()
{
int i j k l m;
printf( "give a three digit number to find Amstrong ");
scanf( d &i);
j=i/100;
k=i 100;
l=k/10;
m=k 10;
j=j*j*j;
l=l*l*l;
m=m*m*m;
if(i==j+l+m)
{
printf( "yes %d is an Amstrong number ", i);
}
else
printf("No %d is not an Amstrong number ", i );
}
No comments:
Post a Comment