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

Blade logic interview question. 1st round is a written tests with 15 multiple questions from c and c++. All are simple basic question. Like int main () { Int i=65; Return printf(ā€œ%cā€, i); } 2nd and 3rd round is technical interview. The position for which I was interview was core UNIX and c. Yes it is for system programming. The company has product name blade server. For their server they are creating their own command for their purpose. Example cd command. We can implement it in a c program by using the chdir() function. So the question asks related to PID, fork, pipe, shared memory, signal. Write a program in c which will act as cp command.

1 Answers   BladeLogic, Infosys,


Explain what is the best way to comment out a section of code that contains comments?

0 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

5 Answers   TCS, Vimukti Technologies,


A marketing company wishes to construct a decision table to decide how to treat clients according to three characteristics: Gender, City Dweller, and age group: A (under 30), B (between 30 and 60), C (over 60). The company has four products (W, X, Y and Z) to test market. Product W will appeal to female city dwellers. Product X will appeal to young females. Product Y will appeal to Male middle aged shoppers who do not live in cities. Product Z will appeal to all but older females.

2 Answers  


write a program in c language to print your bio-data on the screen by using functions.

0 Answers  






What are categories used for in c?

0 Answers  


how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y

2 Answers   TCS, Tech Synergy,


How do you initialize pointer variables?

0 Answers  


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

0 Answers   Aegis, CDAC, Infosys,


char p="data"; printf(p);

2 Answers  


When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?

2 Answers   Aloha Technology,


what is the advantage of function pointer

16 Answers   CMC, CS, Freshdesk, L&T, LG Soft, Matrix, TCS,


Categories