Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to check whether a number is Peterson or not.

Answer Posted / rama krishna sidhartha

Peterson number means sum of factorials of digits of a given
number.

//code :
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c,s=0,m,i,f=1;
clrscr();
printf("\n ENTER A VALUE : ");
scanf("%d",&n);
m=n;
while(n>o)
{
c=n%10;
for(i=0;i<c;i++)
f=f*i;
s=s+f;
f=1;
n=n/10;
}
if(s==m)
printf("\n THE ENTERED NUMBER IS PETERSON
NUMBER.");
else
printf("\n THE ENTERED NUMBER IS NOT A
PETERSON NUMBER.");
getch();
}

Is This Answer Correct ?    56 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you print an address?

1268


What are enumerated types?

1187


Describe the steps to insert data into a singly linked list.

1071


Write the control statements in C language

1206


What are 'near' and 'far' pointers?

1040


Is a house a mass structure?

1089


Write programs for String Reversal & Palindrome check

1059


What is the size of array float a(10)?

1143


When should I declare a function?

1127


Hai what is the different types of versions and their differences

1939


int far *near * p; means

3554


Explain what is output redirection?

1195


Explain what are reserved words?

1103


What does != Mean in c?

1049


What is wrong with this program statement?

1035