what is the coding of display the factorial of a number
using array and function?
Answer / 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 |
What are operators in c?
What are pointers in C?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What is the g value paradox?
What are the different flags in C? And how they are useful? And give example for each in different consequences?
1. What will be the output of the following programs. a) #include <stdio.h> Main() { Int x=4; While(x==1) { X=x-1; Printf(“%d”,x); --x; } }
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
Are pointers really faster than arrays?
Which is best book for data structures in c?
How to implement call back functions ?
How many types of arrays are there in c?
While(1) { } when this loop get terminate is it a infinite loop?