PPS Practical 17

PPS Practical 17
  • Aim: Write a C program to find factorial of a given number.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    void main()
    {
        int d,i,fact=1;
        // clrscr();
        printf("Enter Numbers : ");
        scanf("%d",&d);
        for ( i = d; i > 0; i--){
            fact*=i;
        }
        printf("Factorial of %d is : %d",d,fact);
        // getch();
    }
  • Output:
Output of practical 17

Comments