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
Which of the following sets of values constitutes a valid RSA public key encryption system?
Gelneren [198K]

Answer:

oh I can't it looks so confusing

6 0
3 years ago
A variable like user_num can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 p
lapo4ka [179]

Answer:

The answer to this question is given below in the explanation section. It is noted that this program is written in C++ using online C++ compiler.

Explanation:

#include <iostream>

using namespace std;

int squared(int num)// this is the function to compute square

   {

       return num*num;

   }

int cube(int num)// this is the function to compute cube

   {

       return num*num*num;

   }

int main()

{

   int user_num, user_num2; // variable declaration

   

       cout<<"Enter the first number: ";//prompt user to enter the number

       cin>>user_num;//store the user entered number into variable

       cout<<"\nEnter the second number: ";//prompt the user to enter the second number

       cin>>user_num2;//store the user entered number into variable

   

   

   cout<<"\nSquared of first number is: "<<squared(user_num);//compute square of user_num and display

   cout<<"\nCube of first number is: "<<cube(user_num);//compute the cube of the user_num and display

   cout<<"\nSquare of second number is: "<<squared(user_num2);//compute the square of user_num2 and display

   cout<<"\nCube of second number is: "<<cube(user_num2);//compute the cube of user_num2 and display

   

   cout<<"\nSum of number 1 and number 2 is: "<<user_num2 + user_num2;//display the sum of user_num2 and user_num

   cout<<"\nProduct of number 1 and number 2 is: "<<user_num2 * user_num;//display the product of user_num and user_num2

   

   

   return 0;//terminate the program

}

                               

7 0
3 years ago
Which protocol is considered to be a dominant protocol for local area networking?
SVETLANKA909090 [29]
ETHERNETis considered to be a dominant protocol for local area networking. 
Protocol refers to the formal guidelines and policies which are used to define communication between two or more devices over an internet network. Protocols govern the end to end processes of communication over the internet.
8 0
3 years ago
Describing Report Tools Functions
Shkiper50 [21]

Answer:

C. format

Explanation:

4 0
3 years ago
__________ is the most refined and restrictive service model. a) IaaS b) CaaS c) PaaS
7nadin3 [17]

Answer:

c) PaaS

Explanation:

Refined and restrictive service model allows the user to use full package of application stack as demand by the service. It should be noted that "PaaS" is the most refined and restrictive service model.

Platform as a Service known as (PaaS ) is computing platform that gives room for the user in the cloud to manage applications.

PaaS helps to overcome the problem in managing the complexity of software licence. Example of PaaS are window Azure,Apache Stratos.

4 0
3 years ago
Other questions:
  • What command would you run from a windows command line to test a computer's network stack?
    7·1 answer
  • What type of hardware and software does Instagram use?
    9·2 answers
  • A bus topology network is most often deployed as a peer-to-peer network. <br> a. True <br> b. False
    7·1 answer
  • What is DAP? How LDAP is different from DAP?
    10·1 answer
  • What forms the foundation of cloud computing?
    12·1 answer
  • You are the network administrator for a school system. Your boss informs you that she is thinking of implementing a BYOD program
    15·2 answers
  • How many bits are used to direct traffic to specific services running on a networked computer?
    6·1 answer
  • What is one of the first power tools you’ll need as electrician
    15·1 answer
  • The Advanced Properties sheet enables you to add which of the following?
    15·1 answer
  • Write a Python program to solve the problem described above. Define a function satisfactory_meal(Meal) which takes a single para
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!