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

Why we use void main in c?

1161


Can you assign a different address to an array tag?

1167


why do some people write if(0 == x) instead of if(x == 0)?

1071


What is the difference between union and structure in c?

1174


What is spark map function?

1127


What is use of bit field?

1291


Why c is procedure oriented?

1069


How many parameters should a function have?

1187


State the difference between realloc and free.

1070


Are global variables static in c?

1165


What does the c preprocessor do?

1105


What are enums in c?

1197


In c language can we compile a program without main() function?

1135


What is the purpose of sprintf() function?

1118


Why is c still so popular?

1042