integer userInput
integer i
integer mid
integer array(20) number
userInput = 1
for i = 0; userInput >= 0; i = i + 1
if number[i] > -1
userInput = Get next input
number[i] = userInput
i = i - 1
mid = i / 2
if i > 9
Put "Too many inputs" to output
elseif i % 2 == 0
Put number[mid - 1] to output
else
Put number[mid] to output
You should state the language you're using in these types of questions; here's an example in C++.
bool onOff = true;
if (onOff)
onOff = false;
else
onOff = true;
Question:
Write one for loop to print out each element of the list several_things. Then, write another for loop to print out the TYPE of each element of the list several_things.
Answer:
The solution in python is as follows:
for element in several_things:
print(element)
for element in several_things:
print(type(element))
Explanation:
The solution assumes that the list several_things has already been initialized.
So, the rest of the code is explained as follows:
This line iterates through the list, several_things
for element in several_things:
This line prints each element
print(element)
This line iterates through the list, several_things for the second time
for element in several_things:
This line prints the type of each element
print(type(element))
011110 is the following base 10 & base 2 numbers in signed magnitude, one’s complement and two’s complement.
c)011110
<u>Explanation:</u>
Converting 10 base signed number as two complements. In computer signed is maintain in registered.
But computer needs all values in bits. In hardware it is considered as on or off methods. ASCII values are converted into bits and executed by CPU.
All values which been entered in computer are taken respective ASCII values and converted to bits. Normally sign symbol are maintained as registered flag which can be know if end user knows assembly programming languages.
Assembly language by which direct interacted with machine languages and faster in executions.