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 is c called c not d or e?

610


What is hungarian notation? Is it worthwhile?

695


Explain bit masking in c?

635


What 'lex' does?

714


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1591






What is an identifier?

624


How can I recover the file name given an open stream or file descriptor?

593


provide an example of the Group by clause, when would you use this clause

1707


Explain which function in c can be used to append a string to another string?

585


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1526


string reverse using recursion

1809


Differentiate Source Codes from Object Codes

821


What are global variables?

646


What is the purpose of main() function?

650


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1505