# Calculate the factorial up to N | C programming

## Calculate the factorial up to N

### Problem:

Read an integer value, which is a Natural number. Find the factorial up to N.#### Input

The input file contains an integer

**N**.#### Output

Print the factorial up to N.### Solution

In C language:#include<stdio.h>

int main()

{

int N,i,factorial;

scanf("%d",&N);

factorial = 1;

for(i=1;i<=N;i++){

factorial = factorial * i;

}

printf("%d",factorial);

return 0;

}

### Discussion:

If you don't understand anything, ask in comment box.

## No comments