Program to find "Factorial value".
Program code for factorial without recursion :
#include<stdio.h>
#include<conio.h>
void main()
{
int i,f=1,n;
clrscr();
printf("\nEnter a value: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("Factorial value = %d",f);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,f=1,n;
clrscr();
printf("\nEnter a value: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("Factorial value = %d",f);
getch();
}
Comments
Post a Comment