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
What are the ten application areas of computer?​
Hoochie [10]

Answer:

Banking and Financial company: Computers are used in bank for electronic money transfer, voucher, ledger, bank sheet, etc. ...

Education: ...

Industries: ...

Entertainments: ...

Hospital: ...

Data processing: ...

Science and Engineering: ...

Offices:

Explanation:

8 0
3 years ago
Heather is troubleshooting a computer at her worksite. She has interviewed the computer’s user and is currently trying to reprod
wlad13 [49]

Answer:

a. Establish a theory of probable cause.

Explanation:

Heather now knows the cause, and She is quite experienced. She is now studying the cause, and she is trying to come up with the theory of probable cause now. And as she will be able to come up with the theory, the practical will follow, and she will be able to remove the fault then. And hence the correct option is as mentioned in the answer section.

5 0
4 years ago
Hamilton is the best
san4es73 [151]

Answer:

Yes he is

Explanation:

6 0
3 years ago
Write two examples of hard copy output?​
amid [387]

if you are asking for hard copy output devices, then two examples would be

printers

plotters

if you are asking for types hard copy documents then two examples would be

letter

card

7 0
3 years ago
In pre-shared key mode, a passphrase should be at least ________ characters long.
alexandr402 [8]
10.......................................

8 0
3 years ago
Other questions:
  • Given that a method receives three parameters a, b, c, of type double, write some code, to be included as part of the method, th
    8·1 answer
  • Read the Security Guide about From Anthem to Anathema on pages 238-239 of the textbook. Then answer the following questions in t
    14·1 answer
  • A tablet computer is a low-cost, centrally managed computer with no internal or external attached drives for data storage.
    10·1 answer
  • A customer has a computer for a home business, but wants to have another computer as a web server. What would be the best soluti
    11·2 answers
  • 5. How would you describe the relationship between blocks of code and commands?​
    14·2 answers
  • O O O O O O O
    9·1 answer
  • Select three advantages of cloud computing.
    12·1 answer
  • How do i make a comment on brainly?
    15·1 answer
  • Give the names of two different places you might find a number represented in hexadecimal
    6·1 answer
  • A company is looking to share data between two platforms in order to extend their functionality. which feature enables communica
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!