Write a C++ program that can compute and the sum and average of 15 numbers.
Answers
/* This program computes and displays the sum and average of 15 numbers.
The program was authored on the Saturday 28th February 2009 */
#include
int main ( )
{
// Declaration of Variables
int count=0;
float x, Sum=0, Average;
for (count=0;count<15;)
{
// Entry of the 15 numbers
count<<"Enter the fifteen numbers \n";
cin>>x;
// The summing up process
Sum = Sum + x;
// The updating of the counting variable
count = count + 1;
}
// Computation of the average of the 15 numbers
Average = Sum/count;
// Displaying the 15 numbers
count<<"The sum of the 15 numbers = "<count<<"The average of the 15 numbers = "<return 0;
}
Kavungya answered the question on May 15, 2019 at 14:43
Next: Describe Identifiers.
Previous: Write a program for input and output operations
View More Computer Programming Questions and Answers | Return to Questions Index
Exams With Marking Schemes
Related Questions
- Describe Identifiers.(Solved)
Describe Identifiers.
Date posted: May 15, 2019. Answers (1)
- Differentiate between signed and unsigned integers.(Solved)
Differentiate between signed and unsigned integers.
Date posted: May 15, 2019. Answers (1)
- Define a variable.(Solved)
Define a variable.
Date posted: May 15, 2019. Answers (1)
- Describe the Typedef in programming.(Solved)
Describe the Typedef in programming.
Date posted: May 15, 2019. Answers (1)
- Describe constants in programming.(Solved)
Describe constants in programming.
Date posted: May 15, 2019. Answers (1)
- Give the three main types of constants.(Solved)
Give the three main types of constants.
Date posted: May 15, 2019. Answers (1)
- Define a selection control structure.(Solved)
Define a selection control structure.
Date posted: May 15, 2019. Answers (1)
- Describe the switch statement.(Solved)
Describe the switch statement.
Date posted: May 15, 2019. Answers (1)
- Describe the loop structure.(Solved)
Describe the loop structure.
Date posted: May 15, 2019. Answers (1)
- Describe the do while control structure.(Solved)
Describe the do while control structure.
Date posted: May 15, 2019. Answers (1)