Professional Documents
Culture Documents
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>
int main()
int a = 2, b = 5, temp;
cout << "a = " << a << ", b = " << b << endl;
temp = a;
a = b;
b = temp;
cout << "a = " << a << ", b = " << b << endl;
return 0;
OUTPUT:
Before swapping.
a = 2, b = 5
After swapping.
a = 5, b = 2