Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What does c value mean?

1262


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1481


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3336


What is the use of structure padding in c?

1114


How are pointers declared in c?

1115


What is a 'null pointer assignment' error?

1252


What is the difference between functions abs() and fabs()?

1215


Write a program to find the biggest number of three numbers in c?

1101


Can you write the function prototype, definition and mention the other requirements.

1201


Wt are the Buses in C Language

3262


Difference between goto, long jmp() and setjmp()?

1235


What is the difference between break and continue?

1686


What is #define in c?

1111


What is character constants?

1232


What is a c token and types of c tokens?

1128