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 / nabanita dutta

#include<stdio.h>
#main()
{
int n,sum=0,r,f=1,i=1,m;
printf("enter anumber");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
for(i=1,f=1;i<=r;i++)
f=f*i;
sum=sum+f;
n=n/10;
}
if(sum==m)
printf("the given number is strong number");
else
printf("the given number is not a strong number");
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is infinite loop?

1052


Difference between pass by reference and pass by value?

1114


what is stack , heap ,code segment,and data segment

2653


What is an array? What the different types of arrays in c?

1129


What is #include cctype?

1088


Which is better between malloc and calloc?

1150


What are pointers?

1073


What is spark map function?

1080


If the size of int data type is two bytes, what is the range of signed int data type?

996


How do you redirect a standard stream?

1071


Can you write the algorithm for Queue?

2053


How many types of operators are there in c?

1005


What is the most efficient way to store flag values?

1149


how many errors in c explain deply

2056


main() { printf("hello"); fork(); }

1166