Q21. Wte a program to define a class Numbers with a method void change(int x, int y), to
interchange or swap the argument values in x and y. Print the numbers before and after
swap.
Answers
Answered by
1
if find it useful appreciate (•‿•) and if u have any doubt u can ask me anytime..
Explanation:
// C program to swap two variables
#include <stdio.h>
int main()
{
int x, y;
printf("Enter Value of x ");
scanf("%d", &x);
printf("\nEnter Value of y ");
scanf("%d", &y);
int temp = x;
x = y;
y = temp;
printf("\nAfter Swapping: x = %d, y = %d", x, y);
return 0;
Similar questions