Professional Documents
Culture Documents
PDS Lab Assignment 2 PDF
PDS Lab Assignment 2 PDF
3. Read two numbers X and Y. Swap (exchange) the value of X and Y using arithmetic
operations. The output will be in the following format:
Before swap
X = <val1> Y = <val2>
After swap
X = <val 2> Y = <val 1>
4. A messaging system reads message as 4-digit positive integer d1d2d3d4 and stores
encoding of the message e1e2e3e4 for security reason. The encoding process is as follows:
ei = (ei+i) mod 4
Original message =
Encoded message =
T >= 90 ➔ Grade = EX
T >= 80 and T < 89 ➔ Grade = A
T >= 70 and T< 79 ➔ Grade = B
T > = 60 and T < 69 ➔ Grade = C
T > = 50 and T < 59 ➔ Grade = D
T > = 40 and T < 49 ➔ Grade = P
T < 40 ➔ Grade = F
Read the values of M, N and K such that M is between 0 and 100; N < = K and print Final
score and Grade in the following format:
Final Score =
Grade is
Your program will read operand 1 and operand 2 and the character constant c for the
respective operation and will display:
Operation is <Addition/Subtraction/multiplication/Division>
Result =