001-005-015
Swapping Variable Values
Medium
Problem Description
Swapping variable Values
In this problem, you will create a program that swaps the values of two integer variables using a temporary variable and displays the results to standard output.
Learning Objective: Understand how to swap values between two variables
Overview
Declare integer variables a with 10 and b with 20, swap their values using a temporary variable, and output both values.
Specifications
- Initialize variable
awith 10 andbwith 20 - Swap values of
aandbusing a temporary variabletemp - Output the swapped values
Output Format
a: 20
b: 10
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up