Question

How to print '1 2 4 8 16 32 64' in C++ with only WhileLoop without...

How to print '1 2 4 8 16 32 64' in C++ with only WhileLoop without adding library?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>

using namespace std;

int main() {
    int i = 1;
    while (i <= 64) {
        cout << i << " ";
        i *= 2;
    }
    cout << endl;
    return 0;
}

Add a comment
Know the answer?
Add Answer to:
How to print '1 2 4 8 16 32 64' in C++ with only WhileLoop without...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Convert the decimal number 22 to -22 using one’s complement. S 64 32 16 8 4...

    Convert the decimal number 22 to -22 using one’s complement. S 64 32 16 8 4 2 1 Convert the decimal number +59 to binary using a standard conversion. S 64 32 16 8 4 2 1 Add the numbers from 21 and 22 together using one’s complement. S 64 32 16 8 4 2 1 Convert the binary number 0001100 using one’s complement. S 64 32 16 8 4 2 1 Convert the binary number 00111000 using one’s complement....

  • Convert the decimal number +107 binary using a standard conversion. S 64 32 16 8 4...

    Convert the decimal number +107 binary using a standard conversion. S 64 32 16 8 4 2 1 Add the numbers from 30 and 31 together using two’s complement. S 64 32 16 8 4 2 1 Convert the binary number 01110011 using two’s complement. S 64 32 16 8 4 2 1 Convert the binary number 00111001 using two’s complement. S 64 32 16 8 4 2 1 Add the numbers from 33 and 34 together using two’s complement....

  • Add the numbers from 24 and 25 together using one’s complement. S 64 32 16 8...

    Add the numbers from 24 and 25 together using one’s complement. S 64 32 16 8 4 2 1 Convert the binary number 00100100 using one’s complement. S 64 32 16 8 4 2 1 1 1 0 1 1 0 1 1 Convert the binary number 00011110 using one’s complement. S 64 32 16 8 4 2 1 1 1 1 0 0 0 0 1 Add the numbers from 27 and 28 together using one’s complement. S 64...

  • A source emits eight messages with probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, and 1/12...

    please, solve ASAP. Thank you. A source emits eight messages with probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, and 1/128, respectively. Find the entropy of the source. Obtain the compact binary code and find the average length of the codeword. Determine the efficiency and the redundancy of the code. A source emits eight messages with probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, and 1/128, respectively. Find the entropy of the source. Obtain the compact binary code and find...

  • 1. On a serial dilution with the following tubes set up, 1:2, 1:4, 1:8, 1:16, 1:32,...

    1. On a serial dilution with the following tubes set up, 1:2, 1:4, 1:8, 1:16, 1:32, and 1:64, there is no visible agglutination in the 1:64 tube. What is the titer of the antibody? A. 32 B. 16 C. 64 D. Cannot be determined 2. If you want to make 2 mL of a 1:20 dilution, how much serum would be needed? 3. When 1.0 mL of serum is added to 3.0 mL of diluent, what dilution does this represent?...

  • Write a java program to print all the powers of 2 below a certain number and...

    Write a java program to print all the powers of 2 below a certain number and calculate their sum Requirements: 1. Accept the upper limit from the user as an integer 2. Make sure the sum variable is of the “long” type. You can assume that the test output will be less than LONG MAX. 3. Print all the numbers as a running sum, and finally print their sum. Please try and restrict yourself to loops, selection statements, and calls...

  • Write a C program to print the figure as follows. 5, Write a C program to...

    Write a C program to print the figure as follows. 5, Write a C program to print the figure as follows. 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 4 6 8 10 12 14 16 18 9 12 15 18 21 24 27 16 20 24 28 32 36 25 30 35 40 45 36 42 48 54 49 56 63 64 72 81 1 Tip: use loop.

  • write a program in java to print all the powers of 2 below a certain number...

    write a program in java to print all the powers of 2 below a certain number and calculate their sum. Make sure your program conforms to the following requirements. 1. Accept the upper limit from the user (as an integer). 2. These numbers grow very fast. make sure the sum variable is of the "long" type. You can assume that the test output will be less that LONG MAX. 3.Print all numbers as a running sum, and finally print their...

  • Q9: Simplify without using a calculator. a) log (64) b) log,(1/3) c) log/2(32) d) log(.00001) Q10:...

    Q9: Simplify without using a calculator. a) log (64) b) log,(1/3) c) log/2(32) d) log(.00001) Q10: Which statement is true? Make corrections to any of the false statements. a) log (x+y) = log.x+logay b) log.(x/y) = log x/logay c) The statement 39=p is equivalent to q=p. Q11: Use properties of logarithms to expand the expression xVx+3 (x+3) as much as possible. In

  • Among 8-bit, 12-bit, 16-bit, 32-bit and 64-bit ADC, which is most appropriate for using that Type...

    Among 8-bit, 12-bit, 16-bit, 32-bit and 64-bit ADC, which is most appropriate for using that Type K thermocouple to measure human body temperature to 4 significant digits (appropriate := accurate yet cost-effective)?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT