Posted by: sumn03cse | December 5, 2008

how to Interchange the Value of Two Variables Without Third Variables

Hi,

It Can Possible In Various Ways. Among Them I have Mentioned Followings..

1st Way(Addition Subtruction Process)

<?php

$var1=30; $var2=10;

$var1=$var1+$var2; // Output $var1=40

$var2=$var1-$var2 //output $var2=40-10=30

$var1=$var1-$var2; //Output=40-30=10

?>

2nd Way(Multiplex Division Process)

<?php

$var1=30; $var2=10;

$var1=$var1*$var2; // Output $var1=300

$var2=$var1/$var2 //output $var2=300/10=30

$var1=$var1/$var2; //Output=300/30=10

?>

Ha ha Wat a awasome!!!!

Advertisement

Responses

  1. valo


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.