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
Explain how do you list files in a directory?
What is a header file?
What is define c?
What is function prototype in c with example?
Is Exception handling possible in c language?
What is the best style for code layout in c?
Write a program to implement queue.
What are the types of c language?
Differentiate between the = symbol and == symbol?
Explain the use of keyword 'register' with respect to variables.
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
How do c compilers work?
What is huge pointer in c?
Explain modulus operator.
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???