Learn by solving small problems

PSeInt exercises that build real programming habits.

Start with simple input and output, then progress to conditions, loops and structured problem solving. Try each exercise before opening the example solution.

Beginner

Greeting program

Ask the user for a name and print a personalized greeting.

  • Input, output, text variables
Show example solution
Algorithm Greeting
  Define name As String
  Read name
  Write "Hello " , name
EndAlgorithm
Beginner

Rectangle area

Read width and height, calculate the area, then display the result.

  • Numeric variables, arithmetic
Show example solution
Algorithm RectangleArea
  Define width, height, area As Real
  Read width
  Read height
  area <- width * height
  Write area
EndAlgorithm
Beginner

Pass or fail

Read a score and print Passed when the score is at least 60.

  • If / Else, comparisons
Show example solution
Algorithm PassFail
  Define score As Real
  Read score
  If score >= 60 Then
    Write "Passed"
  Else
    Write "Try again"
  EndIf
EndAlgorithm
Intermediate

Even numbers

Print the even numbers from 2 to 20 using a loop.

  • For loop, repetition
Show example solution
Algorithm EvenNumbers
  Define i As Integer
  For i <- 2 To 20 Step 2 Do
    Write i
  EndFor
EndAlgorithm
Intermediate

Average of five values

Read five numbers, add them and display their average.

  • Loops, accumulator, average
Show example solution
Algorithm AverageFive
  Define i As Integer
  Define value, total As Real
  total <- 0
  For i <- 1 To 5 Do
    Read value
    total <- total + value
  EndFor
  Write total / 5
EndAlgorithm
Intermediate

Simple menu

Show a small menu and react to the option selected by the user.

  • Selection, menu logic
Show example solution
Algorithm Menu
  Define option As Integer
  Read option
  According To option Do
    1: Write "Start"
    2: Write "Help"
    Otherwise: Write "Invalid option"
  EndAccording
EndAlgorithm

Want the concepts before the exercises?

Follow the guide in order, then come back and solve these without copying the examples.

Beginner guide