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
adell [148]
3 years ago
11

Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Displ

ay the factorial.
Computers and Technology
1 answer:
ValentinkaMS [17]3 years ago
3 0

Answer:

Following are the program in c++ language

#include <iostream> // header file

using namespace std;// namespace

int main() // main function

{

    int num; // variable declaration

    long int f=1; // variable declaration

   do

   {

       cout<<"Enter the Positive value:";

       cin>>num;

   } while(num<0); // i check whether   number is non negative or not

   while(num>0) // iterating over the loop

   {

       f=f*num; // calculate the factorial

       num--; // decrement the value of num by 1

   }

   cout<<" factorial is :"<<f; // display the factorial .

   return 0;

}

Output:

Enter the Positive value:7

factorial is :5040

Explanation:

Following are the description of the program .

  • Read the input by user in the "num" variable of "int" type..
  • The do-while will check the enter number is nonnegative number.  
  • While(n>0) loop is calculating the factorial in the  "f" variable .
  • Finally display the factorial .  
You might be interested in
In a Python dictionary, an association is formed between what two components of the dictionary?
babunello [35]

Answer:

Yes, an association is formed between key and its value.

Explanation:

A dictionary in python is an unordered data structure where 2 elements are entered for each entry - a key and its value. Unlike list, we have to give the index through which we want to access that value. This is more flexible than lists as in lists index can be of int type only but in dictionary key can be of any datatype. For example :

dict = { "apple: 1 , "banana" : 2 }

Every element need not be of same type, they can differ too.

5 0
3 years ago
Write a program that multiplies two hard-coded numbers, then prints the individual numbers out and prints their product out, all
sp2606 [1]

Answer:

Written in Python:

num1 = 10

num2 = 15

print(num1)

print(num2)

print(num1 * num2)

Explanation:

The programs requires that two number be assumed and multiplied.

The program uses num1 and num2 to represent the two numbers (line 1 and line2)

These numbers were then initialized to 10 and 15, respectively (note that, you can replace these numbers with any number of your choice)

The next two lines then print num1 and num2

The last line prints the result of their multiplication

However, line by line explanation is as follows:

<em>This line initializes num1 to 10</em>

num1 = 10

<em>This line initializes num2 to 15</em>

num2 = 15

<em>This line prints num1</em>

print(num1)

<em>This line prints num2</em>

print(num2)

<em>This line prints the product of num1 and num2</em>

print(num1 * num2)

5 0
3 years ago
Scenario: The deputy incident commander will be replacing the current incident commander, who needs to attend to a family emerge
Flauer [41]

The current incident commander should: provide a transfer of command briefing to the new commander.

<h3>What is incident management?</h3>

Incident management can be defined as a strategic process through which a business organization (company) identifies, analyzes, and correct hazards and potential threats (problems), so as to ensure that normal service operation is restored as quickly as possible to its end users after a disruption, as well as to prevent a re-occurrence of these hazards in the future.

<h3>What is a command?</h3>

A command can be defined as a set of instruction which sets and provide the incident strategies, priorities, objectives, as well as possessing the overall responsibility for any incident.

In this scenario, we can infer and logically deduce that the current incident commander should provide a transfer of command briefing to the new commander because rank, grade, and seniority aren’t factors that are used to select an incident commander.

Read more on incident management here: brainly.com/question/11595883

#SPJ4

5 0
2 years ago
You have just installed a new NIC in your PC to replace the old one that had started malfunctioning. What additional software mu
miskamm [114]

Answer:

The additional software that must be installed is a device driver.  

Explanation:

Device driver is a software program that is used to control a device connected to a computer.

If a user later buys a new type of device that the operating system did not recognize, new device driver will have to be installed just as in the given question when new NIC is installed. Device driver allows communication between hardware device and operating system.

So device driver will allow the OS to communicate with the new installed NIC.

4 0
3 years ago
A short circuit can cause _______ because there is nothing in the circuit to limit the current and absorb the electrical energy.
Marta_Voda [28]

Answer:

Fire

Explanation:

You'll get a giant spark. The electricity will flow freely causing over-heating or fire.

4 0
3 years ago
Other questions:
  • True or false? malware problems and other compromises of your computer information are rare.
    15·1 answer
  • Does the steelseries arctis 9x work with a pcie bluetooth card in windows
    13·1 answer
  • Banking, insurance, telecommunications, and education are examples of the type of knowledge industry that A. has information as
    12·2 answers
  • You will be given a value of n and k, one line each. You will write a program that determines the minimum number of probe attemp
    9·1 answer
  • Which vendor certification would you think is the most relevant in the field of IT security? Why?
    7·1 answer
  • For which purpose is RAM used?
    7·2 answers
  • Any one have a snnaap chhhaatt if so i need help with something n there
    15·2 answers
  • An administrator has just changed the IP address of an interface on an IOS device. What else must be done in order to apply thos
    5·2 answers
  • So im new how exactly does this point system work???​
    6·1 answer
  • Mention two cables that connect the monitor to the system unit​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!