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

What are type modifiers in c?

1097


What is the function of this pointer?

1458


What are the advantages of Macro over function?

2096


What does c in a circle mean?

1130


What are void pointers in c?

1062


Linked lists -- can you tell me how to check whether a linked list is circular?

1133


What are the differences between Structures and Arrays?

1273


What is a lookup table in c?

1175


Can math operations be performed on a void pointer?

1105


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1158


What is a class c rental property?

1145


Can a void pointer point to a function?

1080


What is printf () in c?

1146


How can you find out how much memory is available?

1114


What are valid signatures for the Main function?

1294