Computer Science, asked by gouravjalan827, 1 month ago

WAP to store a number. Now display cube of the number if its positive otherwise display its square Qbasic​

Answers

Answered by anindyaadhikari13
1

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎de 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

\texttt{\textsf{\large{\underline{Logic}:}}}

  • 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