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 Perfect & Angstrong No.

Click Here To Download C File Of This Program

 //Program to check wether the given no. is perfect no. or armstrong no.  
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int b,p,s,x;
int t,r=0,a=1;
clrscr();
printf("\n\tEnter The No. :");
scanf("%d",&b);
p=b;
s=0;
while(p>0)
{
x=p%10;
s=s+(x*x*x);
p=p/10;
}
if(s==b)
printf("\n\tThe No is Armstrong No.");
else
printf("\n\tThe No is not Armstrong No.");
getch();
t=b;
r=0;
while(a<=t/2)
{
if((t%a)==0)
r=r+a;
a++;
}
if(r==t)
printf("\n\tThe No. is Pefect");
else
printf("\n\tThe NO. is Not Perfect");
getch();
}

0 comments:

Post a Comment