Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int no1,temp1,sum=0,n;
clrscr();
printf("\n enter the no ");
scanf("%d",&no1);
temp1=no1;
while(no1!=0)
{
n=no1%10;
sum=sum+n*n*n;
n01=no1/10;
}
if(sum==temp1)
printf("\n the %d is armstrong",temp1);
elseprintf("\n the %d not armstrong",temp1);
getch();
}
Output:
What is Armstrong no ?
the no is said to be armstrong if satisfy the following condition ,i.e 153=1*1*1+5*5*5+3*3*3
#include<stdio.h>
#include<conio.h>
void main()
{
int no1,temp1,sum=0,n;
clrscr();
printf("\n enter the no ");
scanf("%d",&no1);
temp1=no1;
while(no1!=0)
{
n=no1%10;
sum=sum+n*n*n;
n01=no1/10;
}
if(sum==temp1)
printf("\n the %d is armstrong",temp1);
elseprintf("\n the %d not armstrong",temp1);
getch();
}
Output:
What is Armstrong no ?
the no is said to be armstrong if satisfy the following condition ,i.e 153=1*1*1+5*5*5+3*3*3
No comments:
Post a Comment