
Asked in Quest Global
Write a program to find the factorial of a number.

AnswerBot
2y
Program to find factorial of a number
Use a loop to multiply the number with all the numbers less than it
Handle the case when the number is 0 or 1 separately
Use recursion to find factorial of a number
3038 SARAVANAN.S
1y
#include<stdio.h>
int main()
{
int n,factorial=1;
scanf("%d",&n);
if(n=0)
printf("1");
else
{
for(int i=1;i<=n;i++)
factorial*=i;
printf("%d",factorial);
}
}
Help your peers!
Add answer anonymously...
Top Engineer Trainee Interview Questions Asked at Quest Global
Q. Write a program to print odd numbers.
Q. Can you provide an example of a do-while loop?
Q. Write a program to print prime numbers.
Interview Questions Asked to Engineer Trainee at Other Companies
Top Skill-Based Questions for Quest Global Engineer Trainee
Python Interview Questions and Answers
400 Questions
Algorithms Interview Questions and Answers
250 Questions
Networking Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

