Saturday, June 29, 2013

Write a program to find the given no is Armstrong or not ?

 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:
image
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 


Like the Post? Do share with your Friends.

No comments:

Post a Comment