write code for a swap function that is given input x10 and y

write code for a swap function that is given input x=10 and y=50 you want the output to be x= 50 and y=10

Solution

/*Program to swap two given numbers*/ #include int main() { int x=10, y=50, temp;/*defining the variables x=10 and y=50 as asked in question and a temporary variable*/ printf(\"Before Swapping\ x = %d\ y = %d\ \",x,y);/*Printing The Real Values*/ temp = x; x = y; y = temp; printf(\"After Swapping\ x = %d\ y = %d\ \",x,y); /*Printing The swapped Values*/ return 0; }
write code for a swap function that is given input x=10 and y=50 you want the output to be x= 50 and y=10Solution /*Program to swap two given numbers*/ #include

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site