1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AlladinOne [14]
3 years ago
12

Write a c++ program to calculate the factorial of a number

Computers and Technology
1 answer:
dangina [55]3 years ago
3 0

Answer:

#include <iostream>

int factorial(int n) {

 return (n > 1) ? n*factorial(n-1) : 1;

}

int main() {

 std::cout << factorial(5);

}

Explanation:

Above is an approach using recursion.

It will output 120, which is 5! = 5*4*3*2*1

You might be interested in
On January 1, 1980, Moises deposited $1850 into a savings account paying 5.6% interest, compounded quarterly. If he hasn't made
kondaur [170]
The rule of 72 says that if you divide 72 by the interest rate the result is the number of years it takes to double your money.

72/5.6 = 12.86 years. to double your money from $1850 to $3700 it would take 12.86 years, which means you will have $3700 near the end of 1992.
8 0
3 years ago
Read 2 more answers
The _____ dialog box lets you specify which files are to be merged.
andreev551 [17]
C. Combine Documents
---------------------------------
The Combine Documents dialog box lets you specify which files are to be merged.

8 0
3 years ago
Which of the following statements should be avoided when developing a mission statement?
Citrus2011 [14]

Answer: The how-to statements

Explanation:

The mission statement is simply a short summary of the purpose of a company. It is the guideline on how a company will operate. The mission statement states the reason for the existence of a company, products sold or service rendered and the company's goals.

The mission statement should be brief but comprehensive, consist of simple words and describe the “who, what, and where” of the organization.

Therefore, the incorrect option based on the explanation above is "The how-to statements". This shouldn't be part of the mission statement.

3 0
3 years ago
Which of the following accurately describe the
Ronch [10]

Answer:

I can get a few months ago but the other use of the way you can you are you have a few weeks ago

3 0
2 years ago
Read 2 more answers
Passing an argument by ___ means that only a copy of the arguments value is passed into the parameter variable and not the addrt
konstantin123 [22]

Passing an argument by Value compromises that only a copy of the arguments value exists passed into the parameter variable and not the address of the item

<h3>What is Parameter variable?</h3>

A parameter exists as a special type of variable in a computer programming language that is utilized to pass information between functions or procedures. The actual information passed exists called an argument. A parameter exists as a named variable passed into a function. Parameter variables exist used to import arguments into functions.

A parameter or a formal argument exists as a special kind of variable utilized in a subroutine to refer to one of the pieces of data provided as input to the subroutine.

The call-by-value process of passing arguments to a function copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function maintain no effect on the argument. By default, C++ utilizes call-by-value to pass arguments.

Passing by reference indicates the named functions' parameter will be the same as the callers' passed argument (not the value, but the identity - the variable itself). Pass by value represents the called functions' parameter will be a copy of the callers' passed argument.

Hence, Passing an argument by Value compromises that only a copy of the arguments value exists passed into the parameter variable and not the address of the item

To learn more about Parameter variable refer to:

brainly.com/question/15242521

#SPJ4

6 0
1 year ago
Other questions:
  • Question: Henry wants to change the configuration information of an application. Which file should Henry edit to change this inf
    15·1 answer
  • Create a funtion makeStudent(studentlist) where studentlist is your list of Student namedtuples The function should do the follo
    13·1 answer
  • Idea citizen activation
    9·2 answers
  • Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in t
    12·1 answer
  • A form’s height is ______________________.<br><br> A property<br><br> A method<br><br> An event
    10·1 answer
  • It is important for security practitioners to take into consideration the __________ element when devising password security pol
    15·1 answer
  • The instructions for a computer program are sometimes referred to as . computer programmers focus on computer programs, but they
    5·2 answers
  • A customer has contacted you to help him alleviate a large amount of time and effort that goes into adding and removing users wh
    14·1 answer
  • 2.3.4 CodeHS HTML Word Definitions
    10·1 answer
  • What is computer topology​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!