Input / Output

INPUT and PRINT make programs interactive and easy to test with multiple cases.

Output (PRINT)

Use PRINT to display values or text.

PRINT "Hello"
PRINT 10

Using Variables in Output

X = 5
PRINT X

Input (INPUT)

INPUT allows the program to receive a value from the user.

INPUT X
PRINT X

Example

INPUT A
INPUT B
PRINT A + B

The program asks for two values and prints their sum.

How INPUT works

  • The program pauses and waits for input
  • The value is stored in a variable
  • Execution continues after input is provided
  • In problem solving, each test case supplies its own input automatically

Types of Input

The input value can be:

  • Number → 10
  • Text → Hello
  • Boolean → true / false

Common Mistake

INPUT X
PRINT X + 1

Make sure the input is a number if you want to perform math.