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]
2 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]2 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
What is the full form of ALU​
Alexandra [31]

Answer: arithmetic logic unit: the part of a central processing unit that performs arithmetic and logical operations.

Srry if it is wrong

I hope it  helps you

6 0
2 years ago
Read 2 more answers
A petrol (gas) station is to be set up for fully automated operation. A driver inputs his or her credit card into the pump, the
malfutka [58]

Answer:

Explanation:

Gas Filling Station has pumps. Pumps have credit card readers. Driver can able to swipe their cards, pumps have Fuel. Pumps card readers communicate with Credit Company. Driver interacts with pump for fuel and credit card.

In this situation the following we need to treat as objects.

They are Pump, Card reader, Fuel tank, communication system, system controller and price table.

Design pattern for the following system is attached below

6 0
3 years ago
What is a license that is paid for by number of machines or number of people using the software?.
Kamila [148]

A license that is paid for based on the number of machines or number of people using the software application (program) is called: purchased license.

<h3>What is a software license?</h3>

A software license can be defined as a formal agreement between an end user (customer) and the owner of a software program or software developer, that allows him or her to perform certain tasks with the software application (program).

<h3>The types of software.</h3>

In Computer technology, there are three (3) main types of software programs based on usage rights and these include the following:

  • Shareware
  • Freeware
  • Purchased license

In conclusion, a purchased license is a type of license that is typically being paid for based on the number of machines or number of people that are using the software application (program).

Read more on software here: brainly.com/question/25703767

5 0
2 years ago
Jhon bought a new printer for his desktop computer. It does not work even though he checked all the cables and cords. What do yo
Roman55 [17]
I think it’s d sorry if it ain’t ..
4 0
2 years ago
What's it called when a program is expandable?
sashaice [31]
Its called a genesis program
6 0
2 years ago
Other questions:
  • A disadvantage of ethernet??
    6·1 answer
  • What happens when you double-click one of the graphic options in the middle panel of the choose a smartart graphic dialog box?
    14·2 answers
  • 14<br> Select the correct answer.<br> Which activity is a marketing technique?
    9·1 answer
  • At a local marketing firm, Steve is the lead Web developer and is responsible for working with customers on their Web designs, d
    9·1 answer
  • Which type of element is , and what is the meaning of that element?
    8·1 answer
  • Please help! I tried this by myself. But I am not sure if this is right.
    8·2 answers
  • Users can customize their Windows device by going to the Control Panel under __________.
    15·2 answers
  • What does an effect allow you to do in<br> EarSketch?
    15·1 answer
  • (True or False) The speed at which data travels on a bus is referred to as the word size.
    6·2 answers
  • Passing an argument by ___ means that only a copy of the arguments value is passed into the parameter variable and not the addrt
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!