Home > Back-end >  2, 2, 4, 8, 16 and 32... When, when, and more than 6000 the number is how many?
2, 2, 4, 8, 16 and 32... When, when, and more than 6000 the number is how many?

Time:09-26

Simple compilation, beginners, used vc + + 6.0

CodePudding user response:

Direct write debugging
 
Int aa=1, aaa=0; While (aaa<6000) aaa +=aa *=2; Cout<(aa/=2);

CodePudding user response:

Windows calculator according to their own good, all is zero at the end of the front is the binary 1, what is this number? 8190, 0 x1FFE

CodePudding user response:

Cycle

CodePudding user response:

This is a geometric sequence, according to the summation formula 2 + 4 + 8 + 16 + 32 +... Equal to 2 ^ (n + 1) - 2, so the result of the first 6002 of logarithmic minus one x, x is the smallest integer result corresponding n, although it's a simple topic, but beginners need to know: programming in the first place to write programs to abstract of title, to write the program, the work of the human brain is more important,

CodePudding user response:

reference 1/f, the wise know already should good karma response:
don't write directly debugging
 
Int aa=1, aaa=0; While (aaa<6000) aaa +=aa *=2; Cout<(aa/=2);

smart Aleck operationThe result is divided by 2 wrong
Direct cout & lt;