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

what are the facialities provided by you after the selection of the student.

2177


What are the types of type qualifiers in c?

1032


what is bit rate & baud rate? plz give wave forms

1914


What is the 'named constructor idiom'?

1032


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

3206


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2694


Stimulate calculator using Switch-case-default statement for two numbers

2922


What does %c do in c?

939


What is the use of typedef in structure in c?

917


Explain the concept and use of type void.

1060


What does == mean in texting?

1213


Explain how are 16- and 32-bit numbers stored?

1208


Do character constants represent numerical values?

1286


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

997


What does != Mean in c?

987