[ create a new paste ] login | about

Link: http://codepad.org/TfIWk6kM    [ raw code | output | fork ]

C++, pasted on Jun 2:
#include <stdio.h>
int main(void)

{
   int n, x;

   int factorial(int n)
   {

      if (x<=0)
      {
         printf("x equals: ");
         return 1;
      }

      else
      {
         return n * factorial(n-1);  //error here
      }

      f(x)=f(x-1)+2;
   }
   return 0;
}


Output:
1
2
3
In function 'int main()':
Line 8: error: a function-definition is not allowed here before '{' token
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: