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 static memory allocation? Explain
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is the advantage of a random access file?
Explain the use of bit fieild.
What is the use of typedef in c?
What is bash c?
what is the role you expect in software industry?
What is getch c?
What is the advantage of c?
How to create struct variables?
What is s or c?
What do you mean by dynamic memory allocation in c?
Write a C program to count the number of email on text
Why header file is used in c?
Explain how do you sort filenames in a directory?