At a glance, that does not compile. Fix it such that it compiles (hint: the first line is already problematic).
Printable View
At a glance, that does not compile. Fix it such that it compiles (hint: the first line is already problematic).
Me thinks you are just copying from somewhere without understanding it, perhaps from some friend or some other source or something.
There is no way you would be doing a recursive function and not understanding variables and how to pass a value into another function.
You should have to stuck to a simple for loop.
like that>Code:include<stdio.h>
main()
int n;
clrscr();
{
printf("Enter a Number");
scanf("%d,&n);
if (n == 0)
return 1;
else
return n * Factorial (n - 1);
}
getch();
Either case a 4 page thread on code that is only 15 lines is far too much.
You are needlessly complicating things for yourself.
You didn't even think about what I suggested earlier. A FOR LOOP is all you need!
i do the loop things. thanks. im sorry if was not good. thanks Then.
Cmon now. What needs to be in the for loop statement?Code:#include <stdio.h>
int main (void) {
double fact;
int i;
printf("Enter number\n");
scanf("%lf",&fact);
for(;; ){
fact = fact*i;
}
return 0;
}
Also what needs to be done after the for loop?
Two very simple things.
okay THanks. brilliant. not like me
okay Thanks to al of you. i will now off.
So you got it working?
Cheers
YES>! tomorrow again because. its already 10:31pm here. i have class tomorow at 7:30am to 6:00Pm..
if your free add me in YM. shy_tye0 -- thats my username.
thanks. smart! pray for me!