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
cricket20 [7]
3 years ago
13

Program C++ I need help!

Computers and Technology
1 answer:
nikitadnepr [17]3 years ago
3 0

Answer:#include <iostream>

using namespace std;

int main()

{

   int factorial = 1;

   for (int i = 5; i > 0; i--) {

       factorial = factorial * i;

   }

   cout<<factorial;

   return 0;

}

Explanation:

You might be interested in
If a computer file will not open, what should you do? A. Make sure you have the correct software to open it. B. Change the name
dem82 [27]

Answer:

A. Make sure you have the correct software to open it.

Explanation:

If a computer file will not open, what you should do is to make sure you have the correct software to open it.

Sometimes, computer users make the mistake of opening files with the wrong software application or program, this often leads to an error due to the incompatibility of the software application with the particular file.

Basically, all software applications are designed and developed for use with specific file extensions or formats and as such, when used to open a file it isn't developed for, it result in an error.

For instance, you cannot use Microsoft Word to open a Coreldraw file or to play music and video files.

<em>Hence, it is necessary and important to ensure that you have the right software associated with a file format before opening any file.</em>

Additionally, actions such as changing the name of the file, continually clicking or opening the file and pressing F1 would never open the file because of the incompatibility issue.

8 0
3 years ago
What is the possible output from system.out.println((int)math.random() * 4)?
antiseptic1488 [7]
<span>int randomWithRange(int min, int max) {
    int range = (max - min) + 1;
    return (int)(Math.random() * range);
}</span>

Output of randomWithRange(2, 5) 5 times:

3 0 1 1 0

6 0
3 years ago
Which of the following guidelines about forwarding e-mail messages is most appropriate?
valentina_108 [34]
The last option: 

Avoid forwarding e-mail messages unless you have permission to do so.
5 0
3 years ago
Read 2 more answers
I'm taking computer science and we are using a software called Python, i never used it before and the assignment is hard for me
Anarel [89]
Python has a help page on google I would definitely recommend that. Here is a link to the beginners guide https://wiki.python.org/moin/BeginnersGuide
3 0
3 years ago
g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
grin007 [14]

Answer:

The cpp program is given below.

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

   

   // variables declared

   int n;

   int sum=0;

   float avg;

   

   do

   {

       // user input taken for number    

       cout<< "Enter a number between 1 and 100 (inclusive): ";

       cin>>n;

       

       if(n<1 || n>100)

           cout<<" Number is out of range. Enter valid number."<<endl;

       

   }while(n<1 || n>100);

   

   cout<<" "<<endl;

   

   // printing even numbers between num and 50  

   for(int num=1; num<=n; num++)

   {

       sum = sum + num;

   }

   

   avg = sum/n;

   

   // displaying sum and average

   cout<<"Sum of numbers between 1 and "<<n<<" is "<<sum<<endl;

   cout<<"Average of numbers between 1 and "<<n<<" is ";

   printf("%.2f", avg);

   

       return 0;

}

OUTPUT

Enter a number between 1 and 100 (inclusive): 123

Number is out of range. Enter valid number.

Enter a number between 1 and 100 (inclusive): 56

 

Sum of numbers between 1 and 56 is 1596

Average of numbers between 1 and 56 is 28.00

Explanation:

The program is explained below.

1. Two integer variables are declared to hold the number, n, and to hold the sum of numbers from 1 to n, sum. The variable sum is initialized to 0.

2. One float variable, avg, is declared to hold average of numbers from 1 to n.

3. User input is taken for n inside do-while loop. The loop executes till user enters value between 1 and 100. Otherwise, error message is printed.

4. The for loop executes over variable num, which runs from 1 to user-entered value of n.

5. Inside for loop, all the values of num are added to sum.

sum = sum + num;

6. Outside for loop, average is computed and stored in avg.

avg = sum/n;

7. The average is printed with two numbers after decimal using the following code.

printf("%.2f", avg);

8. The program ends with return statement.

9. All the code is written inside main() and no classes are involved.

3 0
3 years ago
Other questions:
  • How can a user choose settings that will customize a presentation so that it is best to be played automatically at a kiosk rathe
    11·2 answers
  • Whereas lines of competition are clearly defined in the more established industries, in the Internet industry they are blurred a
    9·1 answer
  • Sheila is using a process of saving files to her desktop and then renaming them. She is
    13·2 answers
  • ICMP
    12·1 answer
  • When using the Simple Query Wizard, Kirsten wanted to transfer all of her available data to a new table. She should click
    14·1 answer
  • 4. How could you apply some of the ideas, principles, or structures of coding to fields of study, industries, or tasks outside o
    8·1 answer
  • What is it called when u want 2 or more cells into 1
    14·2 answers
  • The science of how an object reacts to its motion through air is called _______________. (12 letters)
    13·2 answers
  • How many pages is 1500 words double spaced 12pt font?
    13·1 answer
  • you have been tasked with configuring a digital information station in the office's lobby. guests will be able to use the statio
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!