207k views
1 vote
Make a simple numeric calculator. It should prompt the user for three numbers. Then add the numbers together and divide by 2. Display the result. Your program must support numbers with decimals and not just integers. If the result is more than 6, display Your result is more that 6! 4.

User Kesava
by
6.3k points

1 Answer

4 votes

Answer:

No programming language stated; I'll answer this question using Python.

(Please note that -> at the last line means indentation)

The program is as follows:

num1 = float(input("Number 1: "))

num2 = float(input("Number 2: "))

num3 = float(input("Number 3: "))

result = (num1 + num2 + num3)/2

print("Result: ",result)

if result > 6:

->print("Your result is more than 6!")

Step-by-step explanation:

The first three lines prompt the user for input of 3 numbers (the number could be decimal, whole numbers, positive or negative numbers)

num1 = float(input("Number 1: "))

num2 = float(input("Number 2: "))

num3 = float(input("Number 3: "))

The next line sums up user input and divides the sum by 2

result = (num1 + num2 + num3)/2

The next line prints the calculated result in the previous line

print("Result: ",result)

The next line determines if the calculated result is more than 6; if yes, the associated print statement is executed

if result > 6:

->print("Your result is more than 6!")

Once again, please note that -> at the last line means indentation

User Mkrnr
by
6.1k points