OCJP

Factorial And Step-Factorial

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
long fac=1;
float s;
clrscr();
printf("\nenter the value of n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fac*=i;
s=1.0/fac;
printf("\nfactorial of %d is %ld step is %f",i,fac,s);

}

getch();
}

Output

Leave a Reply

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


× How can I help you?