Monday, 8 July 2013

Program to print 3 digit number and print it is armstrong or not

#include <stdio.h>
void main()
{
int n,a,b,c,x,t;
clrscr ();
printf("Enter the 3 number");
scanf("%d",&n);
a= n%10;
x= n/10;
b= x%10;
c= x/10;
t=a*a*a+b*b*b+c*c*c;
if(t==n)
printf("It is armstrong");
else
printf("Not Armsrong");
getch();

}

No comments:

Post a Comment