Write a C++ program that can compute and the sum and average of 15 numbers.

      

Write a C++ program that can compute and the sum and average of 15 numbers.

  

Answers


Kavungya
/* 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