2.WRITE A PROGRAMME TO PRINT THE FACTORIAL OF THE GIVEN NUMBER
Answers
Answered by
4
PROGRAM:
#include<stdio.h>
int main()
{
int i,fact=1,number;
printf("Enter a number: ");
scanf("%d",&number);
for(i=1;i<=number;i++){
fact=fact*i;
}
printf("Factorial of %d is: %d",number,fact);
return 0;
}
OUTPUT:
Enter a number:5
Factorial of 5 is: 120
For example if we entered number 5 then we get the above output
Hope you understand it.
Mark as brainlist please
Similar questions