#include <stdio.h>
#include <conio.h>
void main()
{
int n,r,res=0,t;
clrscr();
printf("\n\n\n\t\t\t Program for calculating an Armstrong number");
printf("\n\n\n\t\t\t Enter any number = ");
scanf("%d",&n);
t=n;
while(n>0)
{
r=n%10;
res=res+r*r*r;
n=n/10;
}
if(t==res)
printf("\n\n\n\t\t\t %d is an Armstrong number.",t);
else
printf("\n\n\n\t\t\t %d is Not an Armstrong number.",t);
getch();
}
#include <conio.h>
void main()
{
int n,r,res=0,t;
clrscr();
printf("\n\n\n\t\t\t Program for calculating an Armstrong number");
printf("\n\n\n\t\t\t Enter any number = ");
scanf("%d",&n);
t=n;
while(n>0)
{
r=n%10;
res=res+r*r*r;
n=n/10;
}
if(t==res)
printf("\n\n\n\t\t\t %d is an Armstrong number.",t);
else
printf("\n\n\n\t\t\t %d is Not an Armstrong number.",t);
getch();
}
No comments:
Post a Comment
kiss on google ads if you are anonymous because your ip is trackable.thank you.
......from.admin