Please help me create a psuedocode for the following question…
“mod” is the remainder function
it is the remainder that results when a non zero integer divides another integer.
suppose m mod n = r and m/n = q where m,n,q, and r are integers then m = q x n + r
9 mod 2 = 1 and 9 = 4 x 2 + 1
8 mod 2 = 0 and 8 = 4 x 2 + 0
8 mod 3 = 2 and 8 = 2 x 3 + 2
11 mod 7 = 4 and 11 = 1 x 7 + 4
22 mod 7 = 1 and 22 = 3 x 7 + 1
What is this output from the following program fragment?
mynum = 10
yournum = 30
if yournum mod mynum = 3 then
yournum = 3
mynum = 1
else if younum mod mynum = 2 then
yournum = 2
mynum = yournum
else
yournum = 1
mynum = younum + 2
end if
display yournum, mynum
Expert Answer
