142k views
4 votes
Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).

1 Answer

3 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

int exam1 = 70;

int exam2 = 85;

int examAverage;

examAverage = (exam1+exam2)/2;

cout <<"The Average of Exam1 and Exam2 is: "<<examAverage<<endl;

return 0;

}

Step-by-step explanation:

Using the C++, we declare the three variables all of type

exam1

exam2 and

examAverage

We assign initial values of 70 and 85 to exam1 and exam2 respectively

User Frank Hagenson
by
4.1k points