#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int factorial(int );
void main()
{
int a, fact=0;
clrscr();
printf("\nEnter a value to get factorial:- ");
scanf("%d",&a);
fact=fact+factorial(a);
printf("\nFactorial of %d is:- %d",a,fact);
getch();
}
int factorial(int num)
{
int i,f=1;
for(i=1;i<=num;i++)
{
f=f*i;
}
return(f);
}
#include<conio.h>
#include<stdlib.h>
int factorial(int );
void main()
{
int a, fact=0;
clrscr();
printf("\nEnter a value to get factorial:- ");
scanf("%d",&a);
fact=fact+factorial(a);
printf("\nFactorial of %d is:- %d",a,fact);
getch();
}
int factorial(int num)
{
int i,f=1;
for(i=1;i<=num;i++)
{
f=f*i;
}
return(f);
}
No comments:
Post a Comment