Swap two values
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Swap two values
IGCSE 0478 · Algorithm writing
Read the question below and attempt it before opening support. Use the specified input/output contract. Check runs several independent cases; one sample output is not enough.
Read integers A and B. Swap their stored values using a temporary variable. Output A then B on separate lines.
Click Run to see the output here.