answersLogoWhite

0

Program in c to generate table of factorials?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

#include
#include

using std::cin;
using std::cout;
using std::endl;
using std::tolower;

long factorial(int N);

int main()
{
int N = 0; //factorial of N
char command = 'n';
do
{
cout << "Enter a number to calculate factorial: ";
cin >> N;

cout << endl << "Factorial of " << N << " is: " << factorial(N) << endl;

cout << "Do you want to continue (y/n)?";
cin >> command;
cout << endl;
} while ('y' == tolower(command));

system("PAUSE");
return 0;
}

long factorial(int N)
{
if (N == 0)
{
return 1;
}
else
{
return (N * factorial(N - 1));
}
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program in c to generate table of factorials?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


How do you write program c of table 5?

#include#includevoid main(){ int a,i;printf("\nThe Multiplication table of 5 is:\n");for(i=1;i


How do you generate a parse tree from an expression using C program?

c code for top down parser


How do you write a binomial distribution table in C program?

Class&amp;genus


C program to generate numbers from 1 to 100 divisible by 2?

(rand()&amp;50+1)*2


Program to generate Fibonacci series using storage class in c plus plus?

i dn't know. haha


Write a c program to generate student mark details using union and find total and average and grade?

write a c program to display marks,total,average,grade using union


What is Peterson number in C?

Peterson Number:145 = 1! + 4! + 5!number=sum of (factorials of digits)


How do you program C programming language in a device?

You need to get an SDK for the device you are planning to program for, SDK also lets you run your program on PC in an emulator. Once written you can then compile the program for device which would generate an installer package that you can then install on the device.


Is there a c program to generate the series a a b a b c?

You need to be more specific in what you are asking. For example, the following meets your requirements: int main() { printf("a a b a b c\n"); return 0; }


Create a c plus plus program to generate Fibonacci series?

#include #include void main() { clrscr() int a=0,b=1,c,i,n; coutn cout


Which program produces the obj file assembly or C plus plus?

A compiler produces object code, which is an obj file.