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 given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]

Answer Posted / dally

#include<stdio.h>
int main()
{
int n = 145;
int i,sum=0,temp;
temp = n;
while(n>1)
{
n=n%10;
sum = sum+fact(n);
printf("%d",sum);
}
if(temp == sum)
printf("Given no is STRONG number\n");
}
int fact(int a)
{
int i=1,fact=1;
fact = i*fact(--i);
return fact;
}

Is This Answer Correct ?    18 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How reliable are floating-point comparisons?

1152


What is the difference between array and pointer?

1085


What is malloc calloc and realloc in c?

1429


Tell me can the size of an array be declared at runtime?

1085


What is the heap in c?

1126


write a program to find out prime number using sieve case?

2140


Explain what is the difference between a string and an array?

1227


Why c is called a mid level programming language?

1112


Is null a keyword in c?

1253


Difference between goto, long jmp() and setjmp()?

1235


Why is extern used in c?

1149


Why doesnt the call scanf work?

1246


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

1130


How do you declare a variable that will hold string values?

1232


Explain what is the benefit of using #define to declare a constant?

1278