Skip to main content

C Program to calculate the factorial of an integer .


    #include<stdio.h>
    #include<conio.h>
    
    main()
    {
    
        long i,n,fac=1;
    
        printf("Enter value of n:");
    
        scanf("%ld",&n);
    
        for(i=n;i>=1;--i)
        {
            fac*=i;
        }
       
        printf("\nFactorial of %ld is %ld",n,fac);
    
        getch(); //to stop the screen
    }