# Program to calculate Factorial of a given number

#include<stdio.h> #include<stdlib.h> int main() { int num, fact = 1; /*Accept a number from the user*/ printf("\nEnter the number: "); scanf("%d", &num); /*Calculate the factorial*/ for(int i=1; i<=num; i++) { fact = fact * i; } /*Display the result*/ printf("The factorial of %d is %d", num, fact); return 0; }

**Output:**

Enter the number: 5 The factorial of 5 is 120

void main(){

int n,s=1;

printf(“enter the nth value”);

scanf(“%d”,&n);

while(n>0)

{

s=s*n;

n–;

}

printf(“the answer is %d”,s);

getch();

}

i get ans fr factorial oly up to 10