You are on page 1of 1

NAME Waheed Akram

ROLL NO 18-arid-5312
CLASS BSCS 6th B
TASK 2 VP

Question no 1 code:

Write a program in C# and get two input values (i.e. 2 and 5) from the user, swap those values
and display the values before and after swapping.
code:

#include <iostream>

using namespace std;

int main()

int a = 2, b = 5, temp;

cout << "Before swapping." << endl;

cout << "a = " << a << ", b = " << b << endl;

temp = a;

a = b;

b = temp;

cout << "\nAfter swapping." << endl;

cout << "a = " << a << ", b = " << b << endl;

return 0;

OUTPUT:

Before swapping.

a = 2, b = 5

After swapping.

a = 5, b = 2

You might also like