what is the coding of display the factorial of a number
using array and function?
Answer Posted / 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 View All Answers
praagnovation
What is #line used for?
What are integer variable, floating-point variable and character variable?
What is volatile keyword in c?
What is void pointers in c?
What are operators in c?
how to build a exercise findig min number of e heap with list imlemented?
Explain what is wrong in this statement?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Is c weakly typed?
write a program to concatenation the string using switch case?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
Explain what is the difference between far and near ?
Why do some versions of toupper act strangely if given an upper-case letter?
What does s c mean on snapchat?