Find Factorial Of N Positive Number In C language(Loops)

 



Write a C program to find factorial of given positive number:

Answer:

#include <stdio.h>

int main()
{
   int n;
   int factorial = 1;
   scanf("%d", &n);

   for (int i = ni >= 1i--)
   {
      factorial  = factorial * i ;
   }
   printf("%d"factorial);
   
   return 0;
}

Now just enter the number and check the result. Thank you

Comments

Popular posts from this blog

C program to find the greatest of three numbers with user input.

Access denied in VS code for gcc while doing C programming

How to add to integers in C programming