Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C PROGRAMMING CODE! Part 1 Practice swapping the values stored in each of 3 variables. Within part1 (), create three integer variables: a,b,c. Initialize (or
C PROGRAMMING CODE!
Part 1 Practice swapping the values stored in each of 3 variables. Within part1 (), create three integer variables: a,b,c. Initialize (or set) each of them to have a different value. This is the only point at which numbers may be used in this routine. When any of these three variables' initial values are altered, the remainder of the code must properly reflect the change(s) Swap the values stored in the variables such that b gets the value from a, c gets the value from b, and a gets the value from c. Using two print statements (see below) (A) first print a notation as to the step, (B) print the values from the variables and then (C) swap the values between the variables, and then (D) repeat as described below. Notice that the values chosen for this example are 11,13, and 17. You may choose any 3 distinct values. Depending on the values you pick, your output must look like this: Before any swap: a is 11, b is 13, c is 17 After the first swap: a IS 17, b is 11, c is 13 After the second swap: a is 13, b is 17, c is 11 After the third swap: a is 11, b is 13, c is 17 Output the initial values and then perform 3 swaps as above. Remember that you are not allowed to use any numbers to perform the swaps. When done properly, the code used in the subsequent swaps will be an (identical) copy of the first swapStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started