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
VikaD [51]
3 years ago
12

What is the output of the following function call? //function body int factorial(int n) { int product=0; while(n > 0) { produ

ct = product * n; n❝; } return product; } //function call cout << factorial(4);
Computers and Technology
1 answer:
maks197457 [2]3 years ago
5 0

Answer:

zero

Explanation:

Because of the define the product variable is zero.

when the function call with pass by value 4.

The program control moves to that function, after that product

store the value zero. Then, product is multiply with n which become zero

because 0 * n is zero and store in the product again.

after that, n'' is wrong it must be 'n--' for performing the factorial function.

after that, the value of n is 3, again loop execute because condition n > 0

is true.

again zero multiply with n and become zero.

this process repeated until condition false and finally the output is zero.

Correction:

To make the code working:

change product = 1 instead of zero.

and change n-- in place of n''.  

You might be interested in
Why is iot architecture important?
Harlamova29_29 [7]
They need to make sure your building is easy to move around in. Beyond the building itself, architecture and design can help bring balance to people's lives. ... Well-designed schools create better learning environments. Workplaces with good architecture experience higher productivity.
7 0
3 years ago
What is a mortgage?
wel
D is the answer. Have a good day!
8 0
2 years ago
Read 2 more answers
Spyware is unwanted and often unsolicited messages. It is not technically malicious software, but can have a serious negative ef
o-na [289]

Answer:

The answer is "Option b".

Explanation:

The given statement is false because the spyware is a malicious program, that infects its device, and steals access to systems data from its web, and the spam also isn't technically malicious, but it could have a serious negative impact through density on the networks, and it is also junk message, which is web slang for an email message, which is primarily unsolicited email.

4 0
3 years ago
(True/False) KM typically means the same thing across different types of businesses.
kicyunya [14]

Answer:

false

Explanation:

7 0
3 years ago
Read 2 more answers
Write a python function genRandomVect that returns a random 1d numpy array of size (50,) where each element is an integer sample
SSSSS [86.1K]

Answer:

import numpy as np

def genRandomVect():

   arr = np.random.choice(range(100),size=(50,),replace=False)

   return arr

 

print("Random 1D numpy array where each element is an integer sampled from: [0, 100) ")

print( genRandomVect() )

Explanation:

  • Create a function to create a numpy array with random integers in range[0,100) with no duplicates
  • Use the random.choice to select random values from range[0,100)  and size attribute to take the size of the required array .
  • Finally return the numpy array.

6 0
3 years ago
Other questions:
  • How do you design video games
    5·1 answer
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • Which of the following is considered a benefit when using slab allocator?
    6·1 answer
  • The goal expressed in this definition states that data visualization is about ________________ .
    11·2 answers
  • A user profile has a login hour restrictions set to. Monday through A user profile has login hour restrictions set to. Monday th
    6·1 answer
  • Dante needs to query a table to find all the references to a particular product and apply a 10%
    7·2 answers
  • What are your thoughts on the last nintendo direct
    5·2 answers
  • GMI = $4,666.67 Total Monthly Deductions $1,131.00 What is the Net Monthly Income (GMI - Total Monthly Deductions) =
    9·1 answer
  • What is Cloud computing? Explain briefly
    15·2 answers
  • Which of the following terms refers to the cells that contain values and labels to be graphed in the chart?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!