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
Nonamiya [84]
4 years ago
8

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

rint the factorial to standard output
Computers and Technology
1 answer:
Effectus [21]4 years ago
5 0

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int num,fact=1;

   cout<<"Positive integer: ";

   cin>>num;

   if(num<0){

   cout<<"Positive integers only";

   }

   else{

       for(int i =1;i<=num;i++){

       fact*=i;

       }

       cout<<num<<"! = "<<fact;

   }

   

   return 0;

}

Explanation:

This line declares num and fact as integer. It also initializes fact to 1

   int num,fact=1;

This line prompts the user for a positive integer

   cout<<"Positive integer: ";

This line gets input from user

   cin>>num;

This line checks if input is negative

   if(num<0){

If input is negative, This line prints the following message

   cout<<"Positive integers only";

   }

   else{

If input is positive or 0; The following iteration calculates the factorial

<em>        for(int i =1;i<=num;i++){</em>

<em>        fact*=i;</em>

<em>        }</em>

This prints the calculated factorial

       cout<<num<<"! = "<<fact;

   }

You might be interested in
Could I use a prepaid card to buy a Brainly membership because I tried to get the trial with a low balance but more than like 5$
EleoNora [17]

Answer:

hey mate !

Explanation:

I think you should ask to brainly itself .....or maybe use it without subscription.... And maybe that would help : )

8 0
3 years ago
The _____ dialog box lets you specify which files are to be merged.
andreev551 [17]
C. Combine Documents
---------------------------------
The Combine Documents dialog box lets you specify which files are to be merged.

8 0
3 years ago
Belvedere Street is parallel to St. Anthony Street. Davidson Street is perpendicular to River Street. River Street is parallel t
Sergio039 [100]

Answer:

Davidson street is perpendicular to Belvedere street

Explanation:

Belevedere is street is parallel to Anthony street which is parallel to Rivers street. Also Davidson street is perpendicular to River street which we already know is parallel to Belvedere street since it is parallel to St Anthony street therefore Davidson street is perpendicular to belverdere street as it is perpendicular to all other street listed:Rivers street and St Anthony street

6 0
3 years ago
Discuss two advantages and two disadvantages of agile methods
Fofino [41]

Answer:

Two advantages of the agile methods are:

  • The agile method require less documentation process as compared to waterfall model and saves maximum time and money. It basically reduces the efforts and the amount of work.
  • In agile method, there is always high customer satisfaction present. In agile method, it is easy to modify in the data as compared to the waterfall model. The customers and developers always interact with each other as the interaction is very important for the good results in the project.

Two disadvantages of the agile methods are:

  • For the large and complex projects, sometimes it is difficult to determine the requirements in the software development as projects are easily go off track.
  • There is less predictability and the projects are easily messed up if the projects requirement are not clear by the customer end.

6 0
4 years ago
Review 03 diagnostic and troubleshooting skills including data gathering methods and techniques.
d1i1m1o1n [39]

The kinds and ways to improve your diagnostic and troubleshooting skills are:

  • Be Relax and never panic when you encounter it.
  • Know everything about your computer.
  • Look for solutions and clues and state them down.
  • Find out the repeatability.

<h3>What is diagnostic and troubleshooting?</h3>

Diagnosing is known to be the act of finding out the root cause of any issue through an act of elimination but troubleshooting is known to be the act of fixing of the problem after diagnosis is said to have been carried out.

Therefore, The kinds and ways to improve your diagnostic and troubleshooting skills are:

  • Be Relax and never panic when you encounter it.
  • Know everything about your computer.
  • Look for solutions and clues and state them down.
  • Find out the repeatability.

Learn more about troubleshooting skills from

brainly.com/question/14983884

#SPJ1

6 0
2 years ago
Other questions:
  • Reggie has hired you to design a home network. The home network will share a printer but will mainly be used to stream movies to
    7·1 answer
  • "Once a business operations analysis is completed and change needs to
    7·2 answers
  • Where can you place CSS statements in an HTML file?
    7·1 answer
  • What is the single most important component of a computer? Central Processing Unit DIP Motherboard Chipset
    8·1 answer
  • In which phase of the software development process would probing questions be used to verify the problem definition?
    12·1 answer
  • Write syntactically correct Javascript code to sort an array of sub-arrays containing integers using the sort and reduce array f
    11·1 answer
  • Write a program that asks the user to enter a series of single digit numbers with nothing separating them. Read the input as a C
    12·1 answer
  • is a measurement that quantifies how much information can be transmitted over the network. A. Memory B. DMZ C. Bandwidth D. Clou
    10·1 answer
  • Assume the user responds with a 3 for the first number and a 4 for the second number.
    13·1 answer
  • Fwee Pwoints Fwor You
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!