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


Please Help Members By Posting Answers For Below Questions

What is malloc return c?

598


What are identifiers in c?

628


What does %c do in c?

582


Explain main function in c?

622


List a few unconditional control statement in c.

557






What is the difference between new and malloc functions?

574


How do I use strcmp?

634


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

631


What is the best way to store flag values in a program?

578


What is a union?

609


Why do we use namespace feature?

577


How many types of operator or there in c?

599


What is a null string in c?

583


What is the use of function in c?

709


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4175