Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(35 points) Implement the conditional statement shown below (A, B, X and Y are variables). Assume A =10, B = 6. Initial values of X,

  1. (35 points) Implement the conditional statement shown below (A, B, X and Y are variables). Assume A =10, B = 6. Initial values of X, Y are 0.

if (X < 10) {

Y = X + A;}

else if (Y > B) {

X = Y A;

}

else {

X = Y + 4;

Y = X + 4;

}

Assignment continued on next page

  1. (35 points) Implement the loop shown below (A, B, X and Y are variables). Assume A, B = 60. Initial values of X, Y are 0.

while ((X < A) || (Y < B)) {

X = X +1;

Y = Y +2;

}

  1. (30 points) Implement the following program in which you will swap consecutive elements of the array

Your array should be stored as a data structure where the first word is the number of elements in the array, followed by the elements of the array. Each element is an integer.

Array values 150, 33, 472, 151, 109, 102

Swap each element in the array with next element of the array. In total N-1 swapping will take place. N is number of elements in the array.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What is the purpose of a customized benefits plan?

Answered: 1 week ago