//Write a program to calculate factorial of any number #include<stdio.h> #include<conio.h> void main() { int i,n,fact=1; clrscr(); printf("Enter any number:\n"); scanf("%d",&n); for(i=1;i<=n;i++) { fact = fact * i; } printf("Factorial of %d = %d",n,fact); getch(); } /*if input number is 4 then 1x2 1x2x3 1x2x3x4 output is 24*/
Comments
Post a Comment