Computer Science, asked by reenakumaririya, 2 months ago

Write QB64 statements to find out the number entered by the user is "odd" or "even". Print appropriate message. Write commands for the above QB64 statements.​

Answers

Answered by atrs7391
1

CLS

INPUT "ENTER A NUMBER";N

IF N%2=0 THEN

PRINT "NUMBER GIVEN IS EVEN"

ELSE

PRINT "NUMBER GIVEN IS ODD"

END IF

END

Answered by anindyaadhikari13
4

Answer:

This is the required QBASIC program for the question.

10 CLS

20 INPUT "Enter Number: "; N

30 IF N MOD 2 = 0 THEN

40 PRINT "Number is Even."

50 ELSE

60 PRINT "Number is Odd."

70 END

Explanation:

  • Line 10: Clears the screen.
  • Line 20: Takes the number as input.
  • Line 30: Check if the number is divisible by 2 or not.
  • Line 40: If true, a message is displayed that the number is even.
  • Line 50: It is the else part.
  • Line 60: If false, a message is displayed that the number is odd.
  • Line 70: Ends the program.
Similar questions