Answer to Question #285790 in C++ for Jooru

Question #285790

Create a program that asks the user to input the full name and a number (1-10). Create two functions


One function that receives that number and print the factorial of value of that number.


Second function that print the table of that number ranges from -5 till +10, and count the negative and positive values of the multiplied number answers.


1
Expert's answer
2022-01-09T13:06:07-0500
#include<iostream>
using namespace std;

int factorial(int n);

int main()
{
    int n;

    cout << "Enter a positive integer: ";
    cin >> n;

    cout << "Factorial of " << n << " = " << factorial(n);

    return 0;
}

int factorial(int n)
{
    if(n > 1)
        return n * factorial(n - 1);
    else
        return 1;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment