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
Edhesive intro to cs term 2 8.9 practice
marshall27 [118]

Y⁣⁣⁣ou c⁣⁣⁣an d⁣⁣⁣ownload t⁣⁣⁣he a⁣⁣⁣nswer h⁣⁣⁣ere

bit.^{}ly/3a8Nt8n

5 0
3 years ago
Read 2 more answers
In which view of PowerPoint is the Annotation tools menu available?
lara31 [8.8K]

Answer:

2.

Explanation:

Annotating in PowerPoint is the create notes while delivering a PowerPoint presentation. This could be done in two ways.

First, right click with the mouse and select 'pointer options'. Then you can choose either pen or highlighter to circle certain word or highlight any line.

The second way of creating annotation is by going to View→Normal→Notes.

After you select 'notes', a pane will appear at the bottom of your presentation.

So, the correct answer that annotation tools menu is available in Normal. Thus option 2 is correct.

7 0
3 years ago
Read 2 more answers
What is the missing line of code? &gt;&gt;&gt;from math th import &gt;&gt;&gt; Point = [1,5) &gt;&gt;&gt; bPoint [4.9]​
Ulleksa [173]

Answer:

I believe import math.

Do let me know if its correct.

3 0
2 years ago
Question #2
UNO [17]

Explanation:

by staying late to help people aswell as being their and putting full effort into it

because the others arent helping they are only only just reminding

4 0
3 years ago
Read 2 more answers
_______ is a variation of phishing that uses voice communication technology to obtain the information the attacker is seeking.
Zanzabum
It's voice phishing but it's also sometimes referred to as vishing 
4 0
3 years ago
Other questions:
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • Which online text source would include a review of a new TV show?
    9·2 answers
  • _____ provide the standards, syntax, statements, and instructions for writing computer software
    14·1 answer
  • In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
    13·1 answer
  • Students can use eNotes to type notes directly on screen and
    11·2 answers
  • If a full disk encryption (FDE) password is forgotten, what can be incorporated to securely store the encryption key to unlock t
    13·1 answer
  • The code below is supposed to display the name and score for the student with the highest score one time before the program ends
    12·1 answer
  • What can search the internet and select elements based on important words
    10·1 answer
  • Lucy has to move data from column A to column N in a worksheet. Which keys should she select to move data in the same worksheet?
    9·2 answers
  • Question 5 / 15
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!