WAP to store a number. Now display cube of the number if its positive otherwise display its square Qbasic
Answers
Answered by
1
The given code is written in QBASIC.
CLS
INPUT "Enter a number: "; A
IF A > 0 THEN
PRINT "Cube of the number is: "; A * A * A
ELSE
PRINT "Square of the number is: "; A * A
END IF
END
- Accept the number.
- Check if number > 0. If true, display the cube of the number.
- If the number is less than 0, display the square of the number.
See the attachments for output.
Attachments:
Similar questions