0
Why does it only give two answers for any inputs?
#include<stdio.h> #include<math.h> int fact(int); void main() { int n,k,x,sum,a,b,i; printf("enter any numbers:"); scanf("%d%d",&a,&b); for(i=a;i<=b;i++) { sum=0; k=i; n=i; while(n>0) { x=n%10; sum=sum+fact(x); n=n/10; } if(sum==k) printf(" %d",sum); } } int fact(int y) { if(y==1) return 1; else return (y*fact(y-1)); }
7 Respostas
0
Prashant Pandey am getting 145 also..
But make this change in fact function if condition
if(y<=1)
In that range only 1, 2, 145 are strong numbers......
0
You can find answer if you know purpose of the program.. What is the purpose of program..?
What are your inputs and output..? Prashant Pandey tried.....
0
I want to know strong numbers between two numbers
0
What are your inputs? Outputs? It only displays
Number == factorial(sum of its digits of Number )
0
Inputs are 1 and 500 and it only outputs 1 and 2
0
Okay thanks
0
You're welcome..