Horje
swap two numbers without using third variable Code Example
swap without using third variable
// SWAPPING WITHOUT USING THIRD VARIABLE
#include<stdio.h>  
 int main()    
{    
int a=10, b=20;      
printf("Before swap a=%d b=%d",a,b);      
a=a+b;//a=30 (10+20)    
b=a-b;//b=10 (30-20)    
a=a-b;//a=20 (30-10)    
printf("\nAfter swap a=%d b=%d",a,b);    
return 0;  
}   
how to swap 2 numbers without 3rd variable
int a = 3;
int b = 5;
a = b*a;
b = a/b
a = a/b
swap 2 integers without using temporary variable
using System;

class MainClass {
  public static void Main (string[] args) {
    int num1 = int.Parse(Console.ReadLine());
    int num2 = int.Parse(Console.ReadLine());
      num1 = num1 + num2; 
      num2 = num1 - num2; 
      num1 = num1 - num2; 
      Console.WriteLine("After swapping: num1 = "+ num1 + ", num2 = " + num2); 
    Console.ReadLine();
  }
}
swap two numbers without using third variable
var a=window.prompt('enter a number')var b=window.prompt('enter a number')var a=a+b;var b=a-b;var a=a-b;console.log ("value of a is",a);console.log('value of b is',b);




Whatever

Related
granges to string peak Code Example granges to string peak Code Example
"What is England to me? The importance of a state is measured by the number of soldiers it can put into the field of battle … It is the destiny of the weak to be devoured by the strong." Code "What is England to me? The importance of a state is measured by the number of soldiers it can put into the field of battle … It is the destiny of the weak to be devoured by the strong." Code
How to turn on ARD on mac using terminal Code Example How to turn on ARD on mac using terminal Code Example
choosen select last item error Code Example choosen select last item error Code Example
Single sprite from spritesheet Code Example Single sprite from spritesheet Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7