Welcome to W3Courses
 Like Us on Facebook

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

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

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

Share