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...

write a program to swap Two numbers without using temp variable.

Answer Posted / ramprasad

class Swap
{
static int iValue,jValue,tot;
public static int swap(int A, int B){
tot = A+B;
iValue = tot-B;
jValue = tot-iValue;
return iValue;
//return jValue;
}
public static void main(String[] args)
{
System.out.println(Swap.swap(5,6));
}
}

Is This Answer Correct ?    23 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a method in c?

1211


What are the uses of null pointers?

1195


write a program to create a sparse matrix using dynamic memory allocation.

4954


What is static volatile in c?

1077


Why c is called procedure oriented language?

1106


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

1304


What is difference between structure and union with example?

1121


Differentiate abs() function from fabs() function.

1071


What are the advantages and disadvantages of a heap?

1258


What is maximum size of array in c?

1084


What do you mean by keywords in c?

1198


What is the difference between array and pointer?

1082


Write a program to implement queue.

1169


What is console in c language?

1139


Do you have any idea about the use of "auto" keyword?

1131