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

Is null valid for pointers to functions?

1170


What is the easiest sorting method to use?

1160


Write a program to check palindrome number in c programming?

1014


write a c program in such a way that if we enter the today date the output should be next day's date.

2192


Why functions are used in c?

1133


What is the return type of sizeof?

1063


What is the difference between struct and union in C?

1306


When we use void main and int main?

1078


List some of the dynamic data structures in C?

1240


Give differences between - new and malloc() , delete and free() ?

1096


What is an lvalue?

1063


If errno contains a nonzero number, is there an error?

1370


If fflush wont work, what can I use to flush input?

1101


What is the purpose of 'register' keyword in c language?

1022


How can I call fortran?

1040