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
Marrrta [24]
2 years ago
9

Write a program that dose the following:

Computers and Technology
1 answer:
Fynjy0 [20]2 years ago
5 0

Answer:

#include<iostream>

#include<cmath>

using namespace std;

int main(){

   float num;

   float sum = 0.0;

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

       cout<<"\nPlease enter the number: ";

       cin>>num;

       sum = sum + round(num);

   }

   float avg = sum/5;

   cout<<"The sum is: "<<sum<<endl;

   cout<<"The average is: "<<avg<<endl;

}

Explanation:

Create the main function and declare the variable 'num' and define the variable sum with zero.

Then, take a for loop and it runs for 5 times because of the condition i<=5.

print the message for the user on the screen, then the user enters the decimal value. After that, round the decimal number to the nearest integer.

we can use inbuilt function round(), which is defined in the cmath library and it takes the argument decimal.

For example:

round(5.89) it gives the integer 6.

Then, take the sum of all-rounded value and this process runs for 5 times. after that, take the average by dividing the sum by 5.

and then, print the sum and average value.

You might be interested in
To place the caption at the top of the image, you will need to change the __________ in the
dsp73
You have to change the options
4 0
3 years ago
Read 2 more answers
Within the try clause of a try statement, you code a. all the statements of the program b. a block of statements that might caus
SVETLANKA909090 [29]

Answer:

B) A block of statement that might cause an exception.

Explanation:

Exception handling is a good programming technique that prevents our program from crashing when an exception occurs during execution. The try clause is used with a catch to handle any exception that might occur, so whenever a statement that might cause an exception is to be used, this should be contained in a try statement block of code.

5 0
3 years ago
Create a cell reference in a format by typing in the cell name or
Neko [114]

Answer:

D. Create a cell reference in a formula by typing in the cell name or clicking the cell.

Further Explanation:

To create a cell reference in a formula the following procedure is used:

First, click on the cell where you want to add formula.

After that, in the formula bar assign the equal (=) sign.

Now, you have two options to reference one or more cells. Select a cell or range of cells that you want to reference. You can color code the cell references and borders to make it easier to work with it. Here, you can expand the cell selection or corner of the border.

Again, now define the name by typing in the cell and press F3 key to select the paste name box.

Finally, create a reference in any formula by pressing Ctrl+Shift+Enter.

6 0
2 years ago
What happens when a user updates a record after a developer creates a Workflow Rule declaratively that updates a field on an obj
Sindrei [870]

Answer:

d. The trigger is fired more than once.

Explanation:

What would happen in this situation is that the  trigger would be fired more than once. This is because the trigger will be fired when the user updates the record. It will also be fired when the process builder is run.

If the trigger fires more than once, this can be problematic for the developer. Therefore, it is better if the trigger fires just once, as this is the time when the present changes can be placed.

5 0
3 years ago
1. Write a program that declares an array named alpha with 50 components of the type double. Initialize the array so that the fi
Aleksandr [31]

Answer:

Explanation:

1. Write a program that declares an array named alpha with 50 components of the type double. Initialize the array so that the first 25 components are equal to the square of the counter (or index) variable and the last 25 components are equal to three times the index variable.  

  double alpha[50];

   for (int i=0;i<25;i++)

   {

       alpha[i]=i*i;

       alpha[i+25]=(i+25)*3;

  }

2. Output the array so that exactly ten elements per line are printed.  

   for (int i=0;i<50;i++)

   {

       cout<<i+1<<". "<<alpha[i]<<" ";

       if (((i+1)%10)==0)

       {

           cout<<endl;

       }

   }

3. Run your program again, but this time change the code so that the array is filled with random numbers between 1 and 100.  

   double alpha[50];

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

   }

   for (int i=0;i<50;i++)

   {

       cout<<i+1<<". "<<alpha[i]<<" ";

       if (((i+1)%10)==0)

       {

           cout<<endl;

       }

   }

4. Write the code that computes and prints the average of elements of the array.  

   double alpha[50],temp=0;

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

       temp+=alpha[i];

   }

   cout<<"Average :"<<(temp/50);

5. Write the code that that prints out how many of the elements are EXACTLY equal to 100.

   double alpha[50],temp=0;

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

       if(alpha[i]==100)

       {

           temp++;

       }

   }

   cout<<"Elements Exacctly 100 :"<<temp;

Please note:  If you put  each of above code to the place below comment  it will run perfectly after compiling

#include <iostream>

using namespace std;

int main()

{

   // If you put  each of above code here it will run perfectly after compiling

   return 0;

}

8 0
3 years ago
Other questions:
  • What is the type of account and normal balance of allowance for uncollectible accounts?
    13·2 answers
  • You have been contracted by a local school to evaluate their computer labs for security threats. They are most worried about the
    6·1 answer
  • The largest group of Linux users is likely to be
    7·1 answer
  • When you create a new slide in a presentation program, you are promoted to choose a placeholder. True or false?
    11·2 answers
  • Within a google form when looking which option do u use?
    13·1 answer
  • When Liam went to print his presentation, the boot process established the connection to the printer, sent the presentation to t
    12·1 answer
  • Which type of computing device is best suited to having a digital pen as an input device?
    9·1 answer
  • Consider the following code segment
    15·1 answer
  • [2]<br> (c) Describe how the microprocessor can determine when to sound the clock alarm.
    6·1 answer
  • you're installing network wiring for a new ethernet network at your company's main office building. the project specifications c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!