Quick actions

cmd+k|ctrl+k

Navigation

Languages

factorial

Snippet info

Language

C

Visibility

public

Author

krishnakanth

Created

2023-01-19T15:33:03.509577Z

Updated

2023-01-19T15:33:03.509577Z

//3. Write a C program to calculate the factorial of a given number.
#include<stdio.h>
main()
{
int n,fact=1,i;
printf("enter a number");
scanf("%d",&n);
i=n;
while(n>0)
{
fact=fact*n;
n=n-1;
}
printf("the factorial of given number %d is =%d\n",i,fact);
}
INFO