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
Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
stiks02 [169]

get organized because of the beging when she start she will want ot be nice and fresh on everything

7 0
3 years ago
import java.util.ArrayList; // Needed for ArrayList class /** This program demonstrates how to store BankAccount objects in an A
slega [8]

Answer:

import java.util.ArrayList; // Needed for ArrayList class

/** This program demonstrates how to store BankAccount objects in an ArrayList. */

// Class ArrayListDemo6 is defined

public class ArrayListDemo6 {

// main method that begin program execution

public static void main(String[] args) {

// Create an ArrayList to hold BankAccount objects.

// The arraylist is called list

ArrayList list = new ArrayList();

// Add three BankAccount objects to the ArrayList.

list.add(new bankAccount(100.0)); list.add(new bankAccount(500.0)); list.add(new bankAccount(1500.0)); // Display each item using a for loop

for (int index = 0; index < array.size(); index++)

{ BankAccount account = list.get(index);

System.out.println("Account at index " + index + "\nBalance: " + account.getBalance());

}

}

}

Explanation:

The code is written in Java and more comments has been added to make it more explanatory.

The code snippet is a demonstration on Arraylist.

First Arraylist is imported. Then, ArrayListDemo6 class is defined. Then the main method which begin program execution.

Inside the main method, a new Arraylist is created called list.

Then we add three BankAccount object to the list.

Lastly, we use a for loop to display each added BankAccount object.

7 0
3 years ago
Which of the following factors wouldn't change an account's optimization score?
MatroZZZ [7]

Answer:

Renaming Campaigns

Explanation:

Based on the information provided within the question it can be said that the factor that wouldn't change this would be Renaming Campaigns. This is because an account's optimization score is an estimate of how well the account/campaign will perform in the near future. Changing the name will not change this score since the campaign is still following the same strategy and therefore the estimates will be the same.

8 0
3 years ago
What key do you press so you can switch tabs quickly?
ss7ja [257]
Alt and tab to switch to open applications
4 0
3 years ago
When you create names for the elements of a webpage (such as ), what are some rules that you can follow to make your HTML code e
shusha [124]

Answer:

by using proper indentation

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Thomas drew a rectangle with an area of 6 square cm what is the greatest possible perimeter of this rectangle
    5·1 answer
  • Who was the creator of the game Fnaf?
    11·2 answers
  • Which behavior of the application should the user expect? A user profile has login hour restrictions set to Monday through Frida
    12·1 answer
  • p3_unzip :: [(a,b)] -&gt; ([a], [b]) Write a function that takes a list of two-tuples and returns a tuple of two lists -- the fi
    9·1 answer
  • Tara and Zach are leading a systems development project and they want the investigation phase to go smoothly and quickly. They d
    10·1 answer
  • Someone gave me flashcards on a keychan. I have to memorize them and then give them back. Can I back them up to my PC by creatin
    5·1 answer
  • What is Microsoft marketing ?
    10·1 answer
  • Why do computers use binary code?
    12·2 answers
  • 3.<br>Give two reasons why everyone should study technology<br>​
    10·1 answer
  • Imagine that you were hired to create the label for a new brand of soup. The client wants to emphasize that the soup has homemad
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!