C-Programming:-
In this tutorials, you will learn-
1) Write a progrm to check whether a number is armstrong or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0,temp,c;
printf("enter any no");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
c=r*r*r;
sum=sum+c;
n=n/10;
}
if(n=sum)
{
printf("number is armstrong ");
}
else
{
printf("number is not armstrong");
}
getch();
}
0 comments:
Post a Comment
If you have any doubt, please let me know