Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
please give me solution of these simple question find factorail
+1
vote
asked
Feb 7, 2020
by
Aakash Sharma
(
130
points)
/*
Complete the function below to find the factorial of a number
If you don’t know what a factorial is, please follow this link -
https://en.wikipedia.org/wiki/Factorial
sample input : findFactorial(4)
output - 24
*/
let findFactorial = (x) => {
// start your code here.
};
module.exports = { findFactorial: findFactorial };
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
2 Answers
0
votes
answered
Feb 13, 2020
by
BlackFlash
(
150
points)
#include<stdio.h>
void main()
{
int i,n,s=1;
printf("\nEnter The Number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
s=s*i;
}
printf("%d!=%d",n,s);
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Feb 13, 2020
by
vaisali katragadda
(
140
points)
#include<stdio.h>
void main()
{
int n;
printf("enter number:");
scanf("%d",&n);
int fact(int n)
{
if(n==1||n==0)
return 1;
else if
printf("enter non-negative number");
else
return n*fact(n-1);
}
printf("the factorial of %d is %d",n,fact(n));
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...