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 is s or c?

1006


What are the ways to a null pointer can use in c programming language?

1073


What are identifiers c?

1017


What is the benefit of using const for declaring constants?

987


explain what are pointers?

966


What do you mean by a local block?

1026


How do I use void main?

1049


What is the easiest sorting method to use?

1096


How can I delete a file?

1013


In C, What is the #line used for?

2094


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

1952


What is calloc()?

1023


Difference between macros and inline functions? Can a function be forced as inline?

1198


all c language question

2374


Write a program to reverse a linked list in c.

1060