ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How do you swap two integer values from two variables without using another variable?

user-image
تم إضافة السؤال من قبل Muhammad Zahid , IT Project Manager , Cozmuler (PVT) Ltd
تاريخ النشر: 2014/02/11
mohamed hassan
من قبل mohamed hassan , Senior Java Developer , IST Networks

let us say the two variables are x & y 

 

x =5 

y =7 

 

now we want y =5 and x =7

 

x = x+y // x =12, y=7

y = x-y // x=12 ,y =5

x = x-y// x =7 and y =5 #

Dima Gupta
من قبل Dima Gupta , Sales Champion , VoliveSolutions

lets say a =10, b =20

 

a = a ^ b

 

b = a ^ b

 

a = a ^ b

 

a =20, b =10

Asif Ali M
من قبل Asif Ali M , Project Lead , LiquidHub

The other logic is here

x = x*y

y = x/y

x = x/y

Apply the formula for x=5 and y=6

x =5*6 =30

y =30/6 =5

x =30/5 =6

now x=6 & y=5

 

 

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟