It’s real my easy you can use a calculator or an online converter. Or division
(111001)₂ = (1 × 2⁵) + (1 × 2⁴) + (1 × 2³) + (0 × 2²) + (0 × 2¹) + (1 × 2⁰) = (57)₁₀
(1100000)₂ = (1 × 2⁶) + (1 × 2⁵) + (0 × 2⁴) + (0 × 2³) + (0 × 2²) + (0 × 2¹) + (0 × 2⁰) = (96)₁₀
(1010101)₂ = (1 × 2⁶) + (0 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰) = (85)₁₀
(1001000)₂ = (1 × 2⁶) + (0 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (0 × 2²) + (0 × 2¹) + (0 × 2⁰) = (72)₁₀
Answer:
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int[] array = new int[10];
int index = 0;
while(index < array.size()){
int number = (rand() % 100) + 1;
for (int i = 0; i < 1; i++) {
array[index] = number;
cout<< "Position "<< index << "of the array = "<< number << endl;
++index;
}
}
}
Explanation:
The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.
Answer:
Transducer is a type of device that converts one type of signal into another.
import random
def random_number_file_writer(nums):
f = open("random.txt", "w")
i = 0
while i < nums:
f.write(str(random.randint(1,500))+"\n")
i += 1
f.close()
def random_number_file_reader():
f = open("random.txt", "r")
total = 0
count = 0
for x in f.readlines():
total += int(x)
count += 1
print("The total of the numbers is "+str(total))
print("The number of random numbers read from the file is "+str(count))
def main():
random_number_file_writer(int(input("How many random numbers do you want to generate? ")))
random_number_file_reader()
main()
I hope this helps!
Answer:
#include <iostream>
using namespace std;
int main() {
int currentYear = 2020;
int myCurrentAge = 23;
int myNewAge=myCurrentAge+(2050-currentYear);
cout << "My Current Age is " << myCurrentAge << endl;
cout << "I will be " << myNewAge << " in 2050." << endl;
}
Explanation:
- Initialize the currentYear with 2020 and myCurrentAge with 23.
- Add myCurrentAge with the the result of (2015 - currentYear) and assign this result to myNewAge variable.
- Finally display my current age and after that display the new age in 2050.
Output:
My Current Age is 23
I will be 53 in 2050.