1.

Solve : write an assignment statement that performs the following operation: adds 2 to a?

Answer»

I'm just starting to learn programming. I understand part of the QUESTION, but I'm not sure when it asks to store the result in b. Can someone help?Welcome to the CH forums.

This sounds very much like homework, if you don't understand the question you should ask your tutor for advice.

Here is a definition of an asignment statement:
Quote

An executable statement that defines or redefines a variable BASED on the result of EXPRESSION evaluation.

As a general rule we don't do homework but ...

A=A + 2

redefines the variable A to the result of expression evaluation A + 2

Good luck with your studies.

I understand you don't like to help with homework, but I'm stuck. I understand everything you just put in your answer. The part I don't understand is when it says to store the result in b. What does that mean? I KNOW how to add 2 to a. Oops, sorry about that, I should have PAID more attention to your post.

Have a look at this:

b=a + 2

So if the value stored in a is 10 then the value stored in b would be 12 (a + 2).

Hope this helps

Never mind. I figured it out. The answer is b=2+a. Thanks anyway.Beat you by just one minute. Which language are you studying?

It's not a specific language. It's logic and design. I understand most of what I have learned so far, but there is so much different stuff, it stumps me some times.


Discussion

No Comment Found