Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
what was the error
+1
vote
asked
Sep 24, 2019
by
Gopi Jonnalagadda
(
250
points)
#include <stdio.h>
int fact(int )
int main()
{
int x;
printf("enter the number x");
scanf("%d",&x);
int res=fact(x);
printf("the factorial of %d is%d",x,res);
return(0);
}
int fact(int n)
{
if(n==1)
return 1;
else
return n*f(n-1);
}
Please
log in
or register to answer this question.
3 Answers
+2
votes
answered
Sep 24, 2019
by
anonymous
1. missing ';' in line "int fact(int )"
2. wrong name "f" in "return n*f(n-1);"
Please
log in
or register to add a comment.
0
votes
answered
Sep 25, 2019
by
anonymous
return n*f(n-1); it will be written as return n*fact(n-1);
int fact(int n); ";" missing
Please
log in
or register to add a comment.
0
votes
answered
Sep 27, 2019
by
pradeep verma
int res is not declared first likt
int x,int res;
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...