Computer Science, asked by arukshitas, 8 months ago

WAP to input any three numbers. Add the first two numb3rs and subtract the third number from the sum. Print the final answer with a proper output system.

Answers

Answered by raunakghetla
2
Code:

num1 = int(input(“Enter first number: “))
num2 = int(input(“Enter second number: “))
num3 = int(input(“Enter third number: “))

calc = num1 + num2 - num3

print(num1, “+”, num2, ”-”, num3, ”=”, calc)

Explanation:
The above code is in python, if using other language convert into that respective language but the logic will remain the same.
Answered by Equestriadash
5

Note that the following codes have been written using Python.

choice = "Yes"

while choice == "Yes":

   x = int(input("Enter a number: "))

   y = int(input("Enter a second number: "))

   z = int(input("Enter a third number: "))

   s = x + y

   r = z - s

   print()

   print(r, "is the obtained result.")

   print()

   choice = input("Would you like to go again? [Yes/No]: ")

   print()

I've added a while loop as well, for the user to go multiple times if he wishes.

The output would look something like this:

Attachments:
Similar questions