Saturday, 6 December 2014

Factorial Calculator in C


//this is a small program that will get you how to calculate factorial in C


//------------------------------------------------------------------------------
#include<stdio.h>

#include <conio.h>
int main()
{
int w=1, x ,  y , z=1;


printf("factorial theorem\n");


scanf("%d",  &y );


for (x=1;x<y ; x++){

    z=x*z;

    printf("%d!=%d\n",w, z);
    w++;
    
}

getch();


}


/*
x=loop variable.......
y=limit of table
w=value--jis ka factorial at the moment liya jaa rha hai i.e. 0! ,1!,2!....
z= answer of factorial
*/

No comments:

Post a Comment