factorial
C

How to create Factorial Program in C Language?


Today we have learned how to create a factorial program in the C language, how to see and understand all this logic up to a certain number of Fibonacci sequences. The logic is simple. Copy the code I gave below and paste it into your TurboC software or code block software and run this program and you will get the result.

#include <stdio.h>
#include <conio.h>

void main()
{
    double i,j=1,no;

    printf("   enter your num :-") ;
    scanf("%lf",&no) ;

    for(i=1;i<=no;i++)
    {
        j = j * i ;

        printf("\n  factorial no of is :- %.lf = %.lf \n",i,j) ;
    }
        printf("------------------------------------------") ;
        printf("\n\n  factorial no is :- %.lf = %.lf\n\n",no,j) ;
        printf("------------------------------------------") ;


}

Output:-

Factorial Output

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *