answersLogoWhite

0

#include<iostream.h>

void swap(int &a,int &b)

{

int t=a;

a=b;

b=t;

}

void main()

{

int x,y;

cout<<"Enter x ";

cin>>x;

cout<<"Enter y ";

cin>>y;

swap(x,y);

cout<<"X= "<<x<<endl;

cout<<"Y= "<<y;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Write a program to find the product of two numbers using Halving and Doubling method?

i need this answer


Write a program to find gcd using recursive method in java?

for two positive integers: public static int gcd(int i1, int i2) { // using Euclid's algorithm int a=i1, b=i2, temp; while (b!=0) { temp=b; b=a%temp; a=temp; } return a; }


Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


How to write java program without using main method?

Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)


How do you write java program using two main method?

When you start your xxxx.class it will execute its 'public static void main (String args[])' method. Any other main methods won't be executed, only if your program explicitly calls them.


Write a sample program using ASPNET explaining all the syntax and semantics of the program?

write a sample program using asp.net explaining all the syntax and semantics of the program


8086 assembly program to sort a list of integers?

assembly language program for sorting an array using 8086 microprocessor.


How do you write Square program using vb?

write a vb program to find the magic square


How do you write a C program to find the GCD of two given integers using non recursive functions?

Use the following function: int gcd (int a, int b) { while (b != 0) { a %= b; a ^= b ^= a ^= b; } return a; } Note that a ^= b ^= a ^= b is an efficient method of swapping two values.


Write Client and server program in C language using UDP?

Write and run a client and a server program in C-language using UDP


How do you write the number 0.5 in the form using integers to show that it is a rational number?

5/10


What is the greatest common factor of 9 and 10 using continuous division method?

The GCF of consecutive integers is 1.