Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Check for Armstrong No.

Click Here To Download C File Of This Program

 //Program to check wether the given no. is armstrong no using functions 
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void armstrong(int n)
{
int i,t,p,s,x;
for(i=1;i<=n;i++)
{
p=i;
t=p;
s=0;
while(p>0)
{
x=p%10;
s=s+(x*x*x);
p=p/10;
}
if(s==t)
printf("\t%d ",t);
}
}
void main()
{
int n;
clrscr();
printf("\n\tEnter The Limit :");
scanf("%d",&n);
printf("\n\tArmstrong Nos Are :");
armstrong(n);
getch();
}

0 comments:

Post a Comment