# Thread: What is this output?

1. ## What is this output?

a= 5 , b = 6

a = (b++) + 3;

c = 2*a + (++b);

d = 2 * (++c) - (a++);

What are the values?

2. Try to reason out the answers then put those statements into a program and see the output for yourself.

3. Originally Posted by laserlight
Try to reason out the answers then put those statements into a program and see the output for yourself.

My program isn't working right now and I don't know what to do. What is the output can someone help me?

4. Originally Posted by xbusterx
My program isn't working right now and I don't know what to do.
Fix it. What is your current program?

5. Originally Posted by xbusterx
My program isn't working right now and I don't know what to do. What is the output can someone help me?
what do you think it should be?
Tell us and we may tell you whether you're right...

6. Originally Posted by xbusterx
a= 5 , b = 6

a = (b++) + 3;

c = 2*a + (++b);

d = 2 * (++c) - (a++);

What are the values?

a = 10, c = 27 ?, dunno what d is

7. Can you produce the steps that you come to that conclusion from? [hint: I think it's wrong, I think I know WHERE you are going wrong, but it's much easier to explain what you are doing wrong if you actually show the individual steps of your calculation].

--
mats

8. Originally Posted by xbusterx
a = 10, c = 27 ?, dunno what d is
Can you tell me what you think the difference is between:
Code:
```b++;
++b;```
Because it seems you mix those two up. I think your answers would be correct if you mix those up .

9. Why do you declare a = 5, then later a = (b++) + 3 o.O?

10. Originally Posted by Akkernight
Why do you declare a = 5, then later a = (b++) + 3 o.O?
I don't think the input is under his control.

Popular pages Recent additions