Accept a no. and check if it is Armstrong or not:
#include<stdio.h>
#include<conio.h>
void main()
{
int no,rem,sum=0,ori;
clrscr();
printf("Enter a no:");
scanf("%d",&no);
ori=no;
while(no>0)
{
rem=no%10;
sum=sum+rem*rem*rem;
no=no/10;
}
if(ori==sum)
printf("Armstrong no");
else
printf("Not Armstrong no");
getch();
}
More C-programs >>>
No comments:
Post a Comment
Thanks for visiting my Blog!