Ah, It was more a logical error ! I should have considered that i was dealing with recursion.
thanks.

wipe out the variable c in your code.

the correct code close to my earlier one should be like this :

/*
Code:
#include<iostream>
#include<conio.h>

using namespace std;

int fac(int n)
{
int c;
if(n<=1)
 return 1;
else
return c = n*fac(n-1);

}


int main()
{

cout<<fac(4);
getch();

}
*/

Last edited by shabbir; 17Mar2009 at 21:42.. Reason: Code blocks