Program to find factorial of a number in C

Source Code

// 15. Program to find factorial of a number
// Arpan Das - CST 2nd Year (VOCLET)

#include <stdio.h>
//#include <conio.h>
//#include <stdlib.h>

void main () {
	int num, fact=1, i;
	//system("cls");
	//clrscr();

	printf("\t\t..:: find factorial of a number ::..\n\n");
	printf("pleae enter any number: ");
	scanf("%d", &num);

	for (i=1; i<=num; i++) fact *= i;

	printf("\nFactorial of %d is %d", num, fact);

	//getch();
}

Output

		..:: find factorial of a number ::..

pleae enter any number: 6

Factorial of 6 is 720

Leave a Reply

Note: Your email address will not be published. Required fields are marked *