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 malloc return c?
What are identifiers in c?
What does %c do in c?
Explain main function in c?
List a few unconditional control statement in c.
What is the difference between new and malloc functions?
How do I use strcmp?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
What is the best way to store flag values in a program?
What is a union?
Why do we use namespace feature?
How many types of operator or there in c?
What is a null string in c?
What is the use of function in c?
Write a c program to build a heap method using Pointer to function and pointer to structure ?