[ create a new paste ] login | about

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

appunti2 - C, pasted on May 1:
#include <stdio.h>

char *input_1 = "11"; // al posto di argv[1];

int
fatt (int x)
{
    int i = (x - 1);

    while (i > 0)
      {
        x = x * i;
        i--;
      }

    return x;
}

int
main (int argc, char *argv[])
{
    int x;
    int z;

    sscanf (input_1, "%i", &x);

    z = fatt (x);

    printf ("%i! = %i\n", x, z);

    return 0;
}


Output:
1
11! = 39916800


Create a new paste based on this one


Comments: