1. Design a swap module that accepts two arguments of the Real data type and swaps them.

2. Validate understanding This was previous answer

PROGRAM: Swap_module
Input: two numbers

Step 1. INPUT number in variable argument[1]
Step 2. INPUT number in variable argument[2]
Step 3. Callswap(arugment[1],argument[2])
Step 4. Exit Program

This is my Code: is this correct

// the swap module accepts two integer arguments and swap the values.

Module swap (Integer Ref a, Integer Ref b)

Declare Integer a;

Declare Integer b;

Declare Integer temp;

Set temp = a;

Set a = b;

Set b = temp;

End Module

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *