The following is a C Program to Find Factorial on screen after taking input from the user. Let's get started.

C Program to Find Factorial
C Program to Find Factorial

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.
for() loop is used to undergo the iteration process.

Program

#include<stdio.h>
#include<conio.h> 
void main()
{
    int x,i;
    unsigned long long int fact=1;
    clrscr();
    printf("Enter a value for x: ");
    scanf("%d",&x);
    for(i=1;i<=x;i++)
    {
        fact=fact*i;
    }
    printf("Factorial of %d is %llu",x,fact);
    getch();
}


Output

Factorial of C Output
Factorial of Number Output

All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program to Find Factorial! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.