Print Factorial | User Given Number | C-Program

To print factorial user given number 

Note: This program is written without using a function.

Code :

#include<stdio.h>

void main()

 {
    int i,n,b=1

    printf("Enter a number to factorial:\n");

    scanf("%d",&n);

    for(i=n;i>=1;i--)

        b=b*i;

    printf("%d factorial is %d \n",n,b);

} 

Output: 


 

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :