1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tresset_1 [31]
3 years ago
4

The variables x and y refer to numbers. Write a code segment that prompts the user for an arithmetic operator and prints the val

ue obtained by applying that operator to x and y.

Computers and Technology
1 answer:
timama [110]3 years ago
8 0

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.

You might be interested in
The following outline is used to plan a program. What is the name for this type of plan?
vladimir1956 [14]
Pseudocode is the answer
7 0
3 years ago
Read 2 more answers
When you are fit, you can exercise and do physical work without getting too tired. A. True B. False\
enot [183]

Answer:

A.

Explanation:

But all of us get tired

3 0
3 years ago
Read 2 more answers
George has to present the goals of information management to his team member. What is a goal of information management? The goal
Law Incorporation [45]

Answer:

The purpose of information management is to: design, develop, manage, and use information with insight and innovation. support decision making and create value for individuals, organizations, communities, and societies.

Explanation:

5 0
3 years ago
Suppose that a CPU scheduling algorithm favors those processes that have used the least processor time in the recent past. Why w
avanturin [10]

Answer:

I/O bound programs will be favored due to the CPU burst request of the I/O programs. This is because their CPU burst request is short and would release the CPU within a short period.

Due to the brief request time of the I/O programs on the CPU, CPU-bound programs will not be permanently starved. After a little while, CPU resources will be released to the CPU-bound programs for use.

6 0
3 years ago
Most search engines work with keyword queries in which you enter one or more words, called _______ _______.
Dennis_Churaev [7]
Search terms.

I hope you like this, please Brainliest me, and have a wonderful night! :D
7 0
3 years ago
Other questions:
  • Which of the following is an example of a logic bug?
    8·1 answer
  • Need Help ASAP!
    14·2 answers
  • A computer is made of up 6 main components: a) CPU (central processing unit)
    7·1 answer
  • What is the process of comparing data with a set of rules or values to find out if the data is correct?
    8·2 answers
  • Create a program that includes a function called toUpperCamelCase that takes a string (consisting of lowercase words and spaces)
    9·1 answer
  • Which questions should you ask yourself when performing research online?
    9·1 answer
  • What is the final value for X ?<br><br> x= 1<br><br> x=13<br><br> x= x+3<br><br> x=0
    9·1 answer
  • 20 points for ez question lol
    9·2 answers
  • Describe from an administrator perspective what is necessary to prepare a storage device for access by a user.
    14·1 answer
  • NAT addresses concerns over the dwindling IPv4 address space by ___________________. 1 point allowing networks to use fewer IP a
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!