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 are the types of data types and explain?
What is pass by reference in functions?
What is a structure member in c?
Tell me what are bitwise shift operators?
C language questions for civil engineering
what are non standard function in c
What are global variables and how do you declare them?
Why C language is a procedural language?
What is the difference between a string and an array?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
Explain what is the purpose of "extern" keyword in a function declaration?
How can I read and write comma-delimited text?
Is that possible to add pointers to each other?