Using visual studio windows32 farmwork to write the question. I upload a picture about the coding style. The question should be like that.
(((((2^0 + 2^1) x 2^2) + 2^3)x 2^4)+2^5……) + 2^n
Hint: Note that when n is even, carrying result is multiplied by 2^n. When n is odd, carrying result is added to 2^n (above formula shows the case where n is odd).
As an example, when n = 5, it should print 352.
You need to have a dialog box to read the value of n.
You need to check for n < 0 and display an appropriate error message.
As n increases, at one point, you will not be able to hold the result in a 32- bit register. You should check for it (probably using jo instruction), display an appropriate error message.
Valid result should be displayed using a message box.


0 comments