Welcome to W3Courses
 Like Us on Facebook

While Loop

Source Code for Calculating Factorial of a Number using a WHILE Loop in C Programming

Following is the source code for calculating the factorial of a number using a WHILE Loop in C Programming.

main()
{
  int a,b;
  printf("Enter a number between 0 and 33: ");
  scanf("%d",&a);
  b=1;
  while(a>=1)
   { b*=a;
     a--;
   }
  printf("%d\n",b);
}

Share