Program: 95
Write a c program to find the factorial value of any number entered through the keyboard.
#include<stdio.h> #include<conio.h> int main() { int num, fact=1, n; printf("Enter a number: "); scanf("%d", &num); n = num; while (num!=0) { fact = fact*num; num = num-1; } printf("The Factorial for %d is %d", n, fact); }
Output:
Enter a number: 5 The Factorial for 5 is 120
Leave a Comment