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 / raghuram

#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 ?    7 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

626


What is the main difference between calloc () and malloc ()?

576


Explain the term printf() and scanf() used in c language?

600


What does typeof return in c?

640


Why c is faster than c++?

637






Explain how do you declare an array that will hold more than 64kb of data?

908


What is define directive?

645


What is a dynamic array in c?

601


What is the use of ?: Operator?

671


int far *near * p; means

3129


When c language was developed?

644


Explain pointers in c programming?

640


Explain what are binary trees?

616


In c programming language, how many parameters can be passed to a function ?

637


Can a pointer be volatile in c?

539