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
Which of the following statements is true of infrastructure?
bazaltina [42]

Answer:

Examples of infrastructure include transportation systems, communication networks, sewage, water, and electric systems. Projects related to infrastructure improvements may be funded publicly, privately, or through public-private partnerships.

3 0
2 years ago
Assume a computer uses pipelining of 9 stages. Each stage demands 3 clock cycles to finish its task. How many clock cycles are n
serg [7]

Answer:

Explanation:

b) Each stage requires one clock cycle; ... Calculate how many clock cycles will take execution of this segment on the regular (non- pipelined) ... Instruction. Clock cycle number . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... It is possible ... It means that all stages of 5-stage pipeline are always busy (no stalls) during the task.

8 0
3 years ago
A ____ resembles a circle of computers that communicate with each other.
Sidana [21]

Answer:

ring network

Explanation:

In a ring network, the nodes are arranged in a circular pattern where each node is connected to two adjacent nodes. In this topology, any node can communicate with any other node via the intermediaries.

In comparison,

- in a star network every communication needs to pass through a central hub node

- in a bus, each node is connected to a shared linear communication bus.

- in a hierarchical network nodes are organized along a tree structure layout.

4 0
3 years ago
How can i get a java complier for linux and ubuntu?
egoroff_w [7]
You can install Eclipse. If you want you can look into the Ubuntu store and see if they have any.
5 0
3 years ago
Which situations are most likey to use Telehealth
Scilla [17]

Answer:

Emergency situations that make it difficult to go to a clinic will likely require Telehealth. Examples include cases of

1. heart attack

2. breathing difficulties

3. health challenges that begin in the night

4. onset of child labor

5. a pandemic situation where hospitals are filled up

6. sickness among aged people in rural communities with no clinic, etc.

Explanation:

Summarily, the World Health Organization (WHO) defines Telehealth as the 'incorporation of Information Communication Technology in the delivery of health care services in situations where patients and health care providers are separated by distance'. Emergency health situations that make it difficult to quickly access medical help can benefit from Telehealth.

In the cases of a pandemic such as the one experienced in 2020, where hospitals were filled to the brim, telehealth proved to be a useful form of health care delivery.

4 0
3 years ago
Other questions:
  • A(n) ____________________ stores copies of data or programs that are located on the hard drive and that might be needed soon in
    9·1 answer
  • What is the different between image processing and machine vision? Please explain with an example.
    11·1 answer
  • It proceeds the statement causes execution of the current loop iteration to end and commence at the beginning of the next loop.
    10·1 answer
  • Read the following scenario, and then answer the question below.
    15·2 answers
  • Which is an advantage that electronic scheduling tools have over paper calendars?
    13·2 answers
  • Universal Containers has two customer service contact centres and each focuses on a specific product line. Each contact centre h
    7·1 answer
  • Please Help Me!!!!!!!!!!!!!
    5·1 answer
  • Can someone tell me what this means Higfaa
    6·1 answer
  • Really helpful, I want to get together tomorrow ,Later I will follow and make it the best answer
    7·1 answer
  • Edit the following statement so it uses the constant named YEAR:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!