Monday 27 August 2012

c program factorial number with array

 C program factorial using Array

How to Write Factorial Program With Array IN C language
 void main()
{
int n;
clrscr();
printf("enter the value \n");
scanf("%d",&n) ;
printf("result=%ld",fact(&n)) ;
getch();
}
long int fact(int* a)
{
long int f=1,sum=0;
int i,j;
for(i=1;i<=*a;i++)
{
for(j=1;j<=i;j++)
{
f=f*i;
}
f=i/f;
sum=sum+f;
}
return sum;
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: