Factorial of a Number(For Loop)

 #include<stdio.h>

int main()

{

    int n,i;

    long fact=1;


    printf("Enter number: ");

    scanf("%d",&n);


    for(i=1;i<=n;i++)

        fact=fact*i;


    printf("Factorial = %ld",fact);

}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices