Respuesta :

Answer:

Here is the Python program. If you want the program in some other programming language let me know.    

x = int(input("Enter the value of x: "))

y = int(input("Enter the value of y: "))

op = input("Enter an arithmetic operator : ")

operation = 0

if op == '+':

   operation = x + y

elif op == '-':

   operation = x - y

elif op == '*':

   operation = x * y

elif op == '/':

   operation = x / y

elif op == '%':

   operation = x % y

else:

   print("Invalid Character!")

print(x, op , y, "=", operation)

Explanation:

The program prompts the user to enter the value of x and y. These values are stored in variables x and y

Then the program prompts the user to enter an arithmetic operator. op variable stores the value of operator entered by the user.

If else statement is used which checks the the character of operator ( +, - , /,  * or %) that the user inputs and performs the arithmetic operation according to the input operator. The if else part that will be executed to perform the arithmetic operation is based on the operator that the user enters. For example if the user enters / then the third elif part is executed and the value of x and y are divided.

The screen shot of output of the program is attached.

Ver imagen mahamnasir

The code segment that prompts the user for an arithmetic operator and prints the value obtained by applying that operator to x and y is as follows:

x = 10

y = 5

arithmetic_operatior = input("Enter any arithmetic operator of your choice: ")

if arithmetic_operatior == '+':

     print(x + y)

elif arithmetic_operatior == '-':

      print(x - y)

elif arithmetic_operatior == '*':

     print(x * y)

elif arithmetic_operatior == '/':

    print(x / y)

elif arithmetic_operatior == '%':

     print(x % y)

else:

    print("Invalid arithmetic operator!")

The code has the x and y variable as 10 and 5 respectively.

Then the variable arithmetic_operatior is use to ask for the user input of any arithmetic operator.

if the user input plus sign the x and y integers values are added and printed.

if the user input minus sign the x and y integers values are subtracted and printed

if the user input multiplication sign the x and y integers values are multiplied and printed

if the user input division sign the x and y integers values are divided and printed

if the user input percentage sign the x and y integers values are divided and the remainder is printed.

Else the user input is an invalid arithmetic operator.

learn more on python here: https://brainly.com/question/18340735?referrer=searchResults

Ver imagen vintechnology