To input a number and prints its square if it is even otherwise print its cube. (Qbasic Code)
- CLS
INPUT "Enter a number"; n
a = n MOD 2
IF a = 0 THEN
ans = n ^ 2
PRINT "The given nuber is even and its square is"; ans
ELSE
ans = n ^ 3
PRINT "The given nuber is odd and its cube is"; ans
END IF
END