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
What is c mainly used for?
How does pointer work in c?
What are local static variables? How can you use them?
What Is The Difference Between Null And Void Pointer?
What is string in c language?
What is a char c?
What are register variables? What are the advantage of using register variables?
What is build process in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What is the difference between formatted&unformatted i/o functions?
What is a pointer on a pointer in c programming language?
What does p mean in physics?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is the use of sizeof () in c?