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 / lalabs

void find_peterson_num ( int num )
{
int sum;
int fact, i;
int temp = num;

do
{
for ( i = 1, fact = 1; i <= (temp % 10); i++)
{
fact *= i;
}

sum += fact;
temp /= 10;

} while ( temp > 0);

if ( sum == temp )
{
printf ( "%d is Perterson number of %d\n", num, sum );
}

printf ( "%d is NOT Perterson number of %d\n", num, sum );
}

Is This Answer Correct ?    8 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you increase the allowable number of simultaneously open files?

1169


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1286


What do you mean by Recursion Function?

1133


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

1103


What is default value of global variable in c?

995


What are pointers? What are different types of pointers?

1157


Which programming language is best for getting job 2020?

1057


What's the best way of making my program efficient?

1110


What is %d called in c?

1241


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1539


What is strcmp in c?

1137


What is data structure in c and its types?

1076


What is the best way to comment out a section of code that contains comments?

1346


Explain the bubble sort algorithm.

1079


What is the scope of an external variable in c?

1053