[artofprogramming] Re: swap

  • From: Fiddle the Second <khyati.gupta267@xxxxxxxxx>
  • To: artofprogramming@xxxxxxxxxxxxx
  • Date: Sun, 22 Sep 2019 13:30:19 +0530

#include<iostream.h>
#include<conio.h>
void main()
    {
          int a = 5, b = 8;
          cout<<"A = "<<a<<"\nB = "<<b;
          int temp = a;
          a = b;
          b = temp;
          cout<<"\nSwapped values: ";
          cout<<"\nA = "<<a<<"\nB = "<<b;
}

On Sun, Sep 22, 2019, 1:16 PM Krupa Sivakumaran <krupa32@xxxxxxxxx> wrote:

Yes. Whoever knows the solution can post it.
Thats what the group is for.
Make some noise.

On 9/20/19, Krupa Sivakumaran <krupa32@xxxxxxxxx> wrote:
Here is the first programming question to the group.

Given two numbers a and b with values 5 and 8, write a program to swap
the values of
a and b, and print them. That is, a should be 8 and b should be 5
after the swap.



Other related posts: