crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Swap two int with temp variable and without temp variable
Question Posted on 01 Sep 2011Home >> DotNet >> C# >> Swap two int with temp variable and without temp variable

Below source code will help you to swap values between two integer with help of temp variable and without temp variable
//define two variable
int i=2;
int j=6;

//with temp varible
int temp //as a temp varible
//swapping
int temp=i; //swap first variable to temp variable
int i=j; //swap value of second variable to first
j=temp //swap temp to second varible

//without temp varible
i=i+j; //add both number
j=i-j; //subtract second from first
i=i-j; //subtract second from first
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Simplest definition of partial classes and its rules?

Definition of Tuple class with some examples?

Define Race Condition in cSharp?

C#.Net Reserve Words

can we inherit private class level variables in c#






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap