0
Check for fisher number!
What is wrong with my code? (I have written in C!) #include <stdio.h> #include <stdlib.h> int main() { int i,mult,n; printf("Enter the number to check for fisher: "); scanf("%d",&n); i=1; while(n>=i) { if(n%i==0) mult*=i; i++; } if((n*n*n)==mult) { printf("Fisher\n"); } else printf("Not fisher\n"); return 0; }
8 Antworten
+ 2
You didn't initialize mult. You will get garbage cause of that.
Also add curly braces to the last else statement.
+ 1
What error msg are you getting?
+ 1
it worked....by mistake i initialised mult to 0 instead of 1
+ 1
If you get the answers mark it. Its easier for others to see if questions are answered or not.
And welcome😁
0
I initialized mult=1 and added curly braces to the last else....still not working
0
Thanks :D
0
what should I mark?
0
Marked it...Thanks again :D