Write a program to calculate factorial using while loop in c Language

Program for calculate factorial using while loop

#include<stdio.h>
#include<conio.h>
void main()
{
   int i, num, fact=1;
   clrscr();
   printf("\nEnter a numbers: ");
   scanf("%d",&num);
   for(i=2; i<=num; i++)
   fact = fact * i;
   printf("\n Factorial of %d is %d",num,fact);
   getch();
}

kabeer

Added  Jul 24, 11:46 am

Article tags

×
Google login
SignUp with Email
X