Visual Basic
Given three already declared int variables, i, j, and temp, write some code that swaps the values i and j.
LANGUAGE: Visual Basic CHALLENGE: Given three already declared int variables, i, j, and temp, write some code that swaps the values i and j. Use temp to hold the value of i and then assign j’s value to i. The original value of i, which was saved in temp, can now be assigned to j.
Read MoreGiven two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values.
LANGUAGE: Visual Basic CHALLENGE: Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values. Declare any variables as necessary, but do not redeclare firstPlaceWinner and secondPlaceWinner.
Read MoreGiven two double variables, bestValue and secondBestValue, write some code that swaps their values.
LANGUAGE: Visual Basic CHALLENGE: Given two double variables, bestValue and secondBestValue, write some code that swaps their values. Declare any additional variables as necessary.
Read MoreGiven an int variable k that has already been declared use a for loop to print a single line consisting of 97 asterisks.
LANGUAGE: Visual Basic CHALLENGE: Given an int variable k that has already been declared use a for loop to print a single line consisting of 97 asterisks. Use no variables other than k.
Read MoreGive that two Integer variables, total and amount have been declared, write a loop that reads non-negative values into amount and adds them into total.
LANGUAGE: Visual Basic CHALLENGE: Give that two Integer variables, total and amount have been declared, write a loop that reads non-negative values into amount and adds them into total. The loop termiantes when a value less tha 0 is read into amount. Don’t forget to initialize total to 0. To read a value into amount…
Read MoreAssume the int variables i, lo, hi and result have been declared and that lo and hi have been initialized.
LANGUAGE: Visual Basic CHALLENGE: Assume the int variables i, lo, hi and result have been declared and that lo and hi have been initialized. Assume further tha result has been initialzied to the value 0. Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result. Your…
Read MoreAssume that an array of integers named a has been declared and initialized.
LANGUAGE: Visual Basic CHALLENGE: Assume that an array of integers named a has been declared and initialized. Write a single statement that assigns a new value to the first element of the array. The new value should be equal to twice the value stored in the last element of the array.
Read MoreAssume that an array of Integers named a that contains exactly five elements has been declared and initialized.
LANGUAGE: Visual Basic CHALLENGE: Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an Integer variable j has also been declared and initialized to a value somewhere between 0 and 3. Write a single statement that assigns a new value to the element of…
Read MoreAn array of Integers named a has been declared with 12 elements.
LANGUAGE: Visual Basic CHALLENGE: An array of Integers named a has been declared with 12 elements. The integer variable k holds a value between 2 and 8. Assign 22 to the element just before a[k].
Read MoreAn array of Integers named a has been delcared with 12 elements. The integer variable k holds a value between 0 and 6. Assign 9 to the element just after a[k].
LANGUAGE: Visual Basic CHALLENGE: An array of Integers named a has been delcared with 12 elements. The integer variable k holds a value between 0 and 6. Assign 9 to the element just after a[k].
Read MoreGiven that an array named a whose elements are of type Integer has been declared, assign the value -1 to the last element in a.
LANGUAGE: Visual Basic CHALLENGE: Given that an array named a whose elements are of type Integer has been declared, assign the value -1 to the last element in a.
Read MoreAssume that an array of Integers named a has been declared with 12 elements.
LANGUAGE: Visual Basic CHALLENGE: Assume that an array of Integers named a has been declared with 12 elements. The integer variable k holds a value between 0 and 6. Assign 15 to the array element whose index is k.
Read More