BobbyBuckets2186 BobbyBuckets2186
  • 15-08-2019
  • Computers and Technology
contestada

11. Describe an algorithm that interchanges the values of the variables x and y, using only assignments. What is the minimum number of assignment statements needed to do this?

Respuesta :

Mustela Mustela
  • 25-08-2019

Answer:

Following is the algorithm to interchange the value of two variable x and y.

step 1:Read the two integer x and y.

step 2 :t=x

Step 3: x=y  

step 4: y=t

The minimum number of assignment to do this is 3

Explanation:

After reading two integer x & y, create a variable "t" of integer type.

with the help of variable "t", we can swap the value of variable x and y.

It requires 3 assignment to interchange the value.

Answer Link

Otras preguntas

Why are tigers killed Or Why are they endangered? No copied answersBest answer will be marked brainliest and spam will be reported​
Asap Select the correct answer. Which function has a restricted domain?
the re-closing of Purine ring in step 11 doesn't consume ATP. Why?
Describe the shape of the given histogram.
Look at pic, I need #4 and F and G could be an answer. I am giving 23 points and will mark brainliest if you tell me how.
PLEASE HELP ME !!!!!!!
Question in the answer below. Please answer with a letter and a reason for the answer. AND NO ASKING FOR ME TO BE YOUR GF!!!
Write a letter to your uncle telling him to help you in paying your school fees​
What should software firm design for the VR sample at Museum?
Order from least to greatest = 9.7 x 103 = 8.2 x 10-7 = 1.2 x 103 = 3.4 x 106 = 5.8 x 10​