Wednesday, February 19, 2014

C Program to Find Factorial Value Using Function

with 0 Comment
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int n,i,f;
clrscr();
printf("\t Factorial Value Using Function:\n");
printf("\t *************************\n");
printf("\nInput:\n");
printf("\n---------\n");
printf("\nEnter the Number:\n");
scanf("%d",&n);
f=fact(n);
printf("\n Output:\n");
printf("\n --------\n");
printf("\n Factorial Value is:%d",f);
getch();
}
int fact(int n1)
{
int i,s=1;
for(i=1;i<=n;i++)
{
s=s*i;
}
return(s);
}

0 comments:

Post a Comment

Powered by Blogger.

Blog Archive