what is the value of b
if a=5;
b=++a + ++a
Answer Posted / anup dixit
13 is the correct answers. I'm attaching here a small java
program which proves this:
The program is:
------------------------------------------------------------
public class TestAddition
{
public static void main(String[] args)
{
int a=5;
System.out.println("1..Before a was : "+a);
int b = ++a + ++a;
System.out.println("Final a was : "+a+ ", int b =
++a + ++a is: "+b);
a=5;
System.out.println("2..Before a was : "+a);
int c= ++a+(++a);
System.out.println("Final a was : "+a+", int c=
++a+(++a) is: "+c);
}
}
------------------------------------------------------------
The output is:
------------------------------------------------------------
1..Before a was : 5
Final a was : 7, int b = ++a + ++a is: 13
2..Before a was : 5
Final a was : 7, int c= ++a+(++a) is: 13
| Is This Answer Correct ? | 15 Yes | 10 No |
Post New Answer View All Answers
What is s or c?
What are the ways to a null pointer can use in c programming language?
What are identifiers c?
What is the benefit of using const for declaring constants?
explain what are pointers?
What do you mean by a local block?
How do I use void main?
What is the easiest sorting method to use?
How can I delete a file?
In C, What is the #line used for?
please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................
What is calloc()?
Difference between macros and inline functions? Can a function be forced as inline?
all c language question
Write a program to reverse a linked list in c.