solve this: Write a program that does the following things listed below. 1. Ask the user…
- User
solve this:
Write a program that does the following things listed below.
1. Ask the user to enter two numbers
2. Finds the average of the two numbers
3. Display the average to the user on the console
4. Display a thank you message to the user.
SAMPLE RUN OF THE PROGRAM
Enter first number: 3.5 Enter second number: 0.5 The average of 3.5 and 0.5 is 2.0. Thank you.STARTER CODE - COPY & PASTE THE CODE BELOW INTO THE ANSWER BOX AND FILL IN THE MISSING CODE
#include using namespace std;
int main() { // your code goes here return 0; }. Return only the response based on my query, do not include any additional text that doesn't relate to what I asked. Please adhere to the following restrictions: 1. Do not include any back ticks or code blocks. 2. Do not use markdown characters or elements, such as ** ** or * *. 3. Avoid unnecessary details or examples that are not directly relevant. 4. For instance, do not write: listed item or any similar format.
- Assistant
#include using namespace std;
int main() { double num1, num2, average; cout << "Enter first number: "; cin >> num1; cout << "Enter second number: "; cin >> num2;
average = (num1 + num2) / 2; cout << "The average of " << num1 << " and " << num2 << " is " << average << "." << endl;
cout << "Thank you." << endl; return 0; }