#include <stdio.h> int main() { int x=1,n,fact=1; printf("Enter n value "); scanf("%d",&n); do { fact=fact*x; printf("\n%d Factorial is %d",x ,fact); x++; }while(x<=n); return 0; }
Enter n value 5
1 Factorial is 1
2 Factorial is 2
3 Factorial is 6
4 Factorial is 24
5 Factorial is 120