#include<stdio.h>
#include<conio.h>
void main()
{
int num,x,digit,sumqube=0;
clrscr();
printf("\n enter the number:\n");
scanf("%d",&num);
x=num;
while(x>0)
{
digit=x%10;
sumqube=sumqube+(digit*digit*digit);
x=x/10;
}
if(sumqube==num)
printf("number is armstrong\n");
else
printf("\n number is not armstrong");
getch();
}
#include<conio.h>
void main()
{
int num,x,digit,sumqube=0;
clrscr();
printf("\n enter the number:\n");
scanf("%d",&num);
x=num;
while(x>0)
{
digit=x%10;
sumqube=sumqube+(digit*digit*digit);
x=x/10;
}
if(sumqube==num)
printf("number is armstrong\n");
else
printf("\n number is not armstrong");
getch();
}
No comments:
Post a Comment