Thursday, April 18, 2013

Write a c++ program that calculates the average of three numbers

10:21 AM


Program to find average of 3 numbers in c++






#include <iostream>
using namespace std;

const int NUM_SCORES = 3;

int main()
{
int score1, score2, score3;
float ave;
cout << "Enter 3 scores separated by spaces: ";
cin >> score1 >> score2 >> score3;

ave = float(score1 + score2 + score3) / float(NUM_SCORES);

cout << "The average of " << score1 << ", " << score2 << ", and "
<< score3 << " is " << ave << "." << endl;
return 0;
}




OUTPUT:

Enter 3 scores separated by spaces: 89
56
885
The average of 89, 56, and 885 is 343.333.







---------------------------------------------------------------------------------------------


---------------------------------------------------------------------------------------------













---------------------------------------------------------------------------------------------


---------------------------------------------------------------------------------------------


--------------------------------
Need help writing a C++ code using loops that 
Write a C++ program to enter 3 integers then computes Write a program that will calculate the average of 3 integers
C++ Program Which Calculates The Average And Sum Of 3 integers
c++ loop - C++ Forum‎
my project - C++ Forum‎
HOW TO WRITE THIS PROGRAM? - C++
Find average, Using array's and function

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top