Previous Next
0 / 15
Module DEMO-33-63DEMO-OOP-33

Swap With Temporary Variable

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read two integers, swap them using a temporary variable, and print the final values.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. left value
  2. right value

Output Format

Print the exact report in this order:

  1. Left
  2. Right

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3
9
Left: 9
Right: 3
Input: left value = 3, right value = 9.
Key calculation(s): temp = 3 | 3 = 9 | "Left: " + 3 = "Left: 9".
Output:
Left: 9
Right: 3
Sample #2
Public sample
10
20
Left: 20
Right: 10
Input: left value = 10, right value = 20.
Key calculation(s): temp = 10 | 10 = 20 | "Left: " + 10 = "Left: 20".
Output:
Left: 20
Right: 10

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings