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

#include<stdio.h>
int fact(int r)
{
if(r=0 || r=1)
return 1;
else
return(r*fact(r-1);
}
void main()
{
int a,n,rem,sum=0
printf("Enter the number\n");
scanf("%d",&n);
a=n;
while(n!=0)
{
rem=n%10;
sum=sum+fact(rem);
n=n/10;
}
if(sum==a)
printf("%d is a strong number",a);
else
printf("%d is not a strong number",a);
}

Is This Answer Correct ?    8 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is FIFO?

666


What is || operator and how does it function in a program?

620


How can I manipulate individual bits?

600


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

755


Tell me what is the purpose of 'register' keyword in c language?

609






Is void a keyword in c?

566


What do you mean by Recursion Function?

625


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2193


what do you mean by inline function in C?

605


What is 02d in c?

628


How do I round numbers?

589


When should you not use a type cast?

651


Explain null pointer.

615


Why do we use return in c?

560


The __________ attribute is used to announce variables based on definitions of columns in a table?

663