Thursday, April 18, 2013

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


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 
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ