Answer:
132
Explanation:
We convert each number to base 10 (decimal) and multiply.
So 1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰
= 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1
= 8 + 0 + 2 + 1
= 11₁₀
1100₂ = 1 × 2³ + 1 × 2² + 0 × 2¹ + 0 × 2⁰
= 1 × 8 + 1 × 4 + 0 × 2 + 0 × 1
= 8 + 4 + 0 + 0
= 12₁₀
So, 1011₂ × 1100₂ = 11₁₀ × 12₁₀ = 132₁₀
So, the decimal equivalent of the product of 1011 and 1100 is 132
Answer:
Program is in C++
Explanation:
C++ Code
1) By using For Loop
void forLoopFunction(int value){
for(int start=value; start>0; start--){
cout<<start<<endl;
}
}
Explanation
Start for loop by assigning the loop variable to parameter value and condition will be that loop variable will be greater then 0 and at the end decrements the loop variable.
2) By usin WhileLoop
void whileLoopFunction(int value){
while(value>0){
cout<<value<<endl;
value--;
}
}
Explanation
In while loop first add the condition as variable must be greater then 0 and then print the value with endl sign to send the cursor to next line and at the end of the loop decrements the variable.
Is that the whole question? or
Answer:
Explanation:
The following code is written in Python and it is a function called filter, which takes in the requested inputs. It then places the threshold in its own variable and pops it out of the array of inputs. Then it loops through the array comparing each element with the threshold and printing out all of the ones that are less than or equal to the threshold.
def filter():
num_of_elements = input("Enter a number: ")
count = 0
arr_of_nums = []
while count <= int(num_of_elements):
arr_of_nums.append(input("Enter a number: "))
count += 1
threshold = arr_of_nums[-1]
arr_of_nums.pop(-1)
print(threshold)
for element in arr_of_nums:
if int(element) < int(threshold):
print(element)
else:
continue
Answer:
Person
Explanation:
At
Person p = new Person(...);
int m1 = p.getMoney( ); // assignment 1
Person class which is base class for all sub class (Student, Employee and Retired ) creates an object which referenced is stored in p variable, and getMoney() is method which refereed Person's getMoney() method, so Person is the answer of above question