20 lines
355 B
C++
20 lines
355 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
// 1. read in two numbers
|
|
// 2. calculate the average (n1 + n2)/2
|
|
// 3. print out the average
|
|
|
|
int main(){
|
|
float num1 = 0;
|
|
float num2 = 0;
|
|
|
|
cout << "Enter a number: ";
|
|
cin >> num1;
|
|
cout << "Enter another number: ";
|
|
cin >> num2;
|
|
|
|
cout << "The average is " << (num1 + num2)/2 << endl;
|
|
|
|
return 0;
|
|
} |