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
Why doesnt this code work?
What is the difference between procedural and functional programming?
Explain how can you restore a redirected standard stream?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What happens if a header file is included twice?
what is the significance of static storage class specifier?
What is array of structure in c programming?
What are Macros? What are its advantages and disadvantages?
What is an lvalue in c?
What is the correct declaration of main?
What's the total generic pointer type?
Can you write the algorithm for Queue?
Explain is it better to bitshift a value than to multiply by 2?
What does c in a circle mean?
Write a program with dynamically allocation of variable.