what is the coding of display the factorial of a number
using array and function?



what is the coding of display the factorial of a number using array and function?..

Answer / balaji ganesh

#include<stdio.h>
int fact(int m)
{
int i,f=1;
for(i=m;i>0;i--)
f=f*m--;
return f;
}
void main()
{
int n,s;
clrscr();
scanf("%d",&n,printf("enter the number:"));
s=fact(n);
printf("factorial of %d is=%d",n,s);
getch();
}

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Interview Questions

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

3 Answers  


why we use "include" word before calling the header file. is there any special name for that include??????

1 Answers   TCS,


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

0 Answers   HCL,


triangle number finding program...

1 Answers   HCL,


Write a program to print the following series 2 5 11 17 23 31 41 47 59 ...

2 Answers  


What is the benefit of using an enum rather than a #define constant?

0 Answers  


Tell us the use of fflush() function in c language?

0 Answers  


What is a string?

0 Answers  


main() { int a=4,b=2; a=b<<a + b>>2; printf("%d", a); }

4 Answers   CTS,


What is the difference between if else and switchstatement

0 Answers  


what is real time system?what is the differance between hard and soft real time systems

2 Answers  


program to print circle structure

1 Answers  


Categories