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
Why is it important to explore an Integrated
dezoksy [38]

Answer:

The answer to this question is given below in the explanation section. The correct answer is B.

Explanation:

The purpose behind to explore an integrated development environment is to learn more about the features of the environment.

So the correct answer is B.

For example, you can use visual studio to build asp.net application using c#, then you need to explore what features visual studio offering to you.

However, other options are incorrect. Because, you can learn more about syntax, error handling, and abstraction in the programming language, not in the IDE.

6 0
2 years ago
Which of the following is part of Connections Academy's AUP regarding the use of the school'supplied technology
sergey [27]
A)technology supplied by connections should only be used for school purposes
6 0
3 years ago
Read 2 more answers
Before you can use the Management Studio to work with the objects in a database, you must ___________ the database files (i.e.,
Lelu [443]

Answer:

You must attach the database files

Explanation:

4 0
3 years ago
For businesses and organizations under recent compliance laws, data classification standards typically include private, confiden
Mnenie [13.5K]
Answer: True






Explanation:
6 0
2 years ago
Difference between website and web server
Volgvan

Answer:

a web server is a computer than runs websites

7 0
2 years ago
Read 2 more answers
Other questions:
  • Describe three general methods for passing parameters to the operating system.
    6·1 answer
  • HTTP is made to facilitate which kind of communication?
    11·1 answer
  • How does modularity provide flexibility in a structured programming design?
    6·1 answer
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • A large institution, such as a bank, may have thousands of transactions to process in which no user interaction is required; whi
    5·2 answers
  • The first step to accurate coding is to identify the ___________ in the diagnostic statement.
    7·1 answer
  • Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
    5·1 answer
  • Write any one method to delete a table in writer​
    11·1 answer
  • Vẽ sơ đồ DFD cho của hàng bán điện thoại ( Môn phân tích và thiết kế hệ thống thông tin)
    10·1 answer
  • The following method in Inventory is intended to count how many batteries are fully charged. What should replace /*Missing Code
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!