


Programs in C language
2. Program to find the factorial of given number.
#include<stdio.h>
#include<conio.h>
void main()
{
int n, p=1;
clrscr();
printf("Enter a number:");
scanf("%d",&n);
while(n>0)
{
p = p * n;
n--;
}
printf("Factorial of given number : %d",p);
getch();
}
Input :6
Output :720