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
Start with simple input and output, then progress to conditions, loops and structured problem solving. Try each exercise before opening the example solution.
Ask the user for a name and print a personalized greeting.
Algorithm Greeting Define name As String Read name Write "Hello " , name EndAlgorithm
Read width and height, calculate the area, then display the result.
Algorithm RectangleArea Define width, height, area As Real Read width Read height area <- width * height Write area EndAlgorithm
Read a score and print Passed when the score is at least 60.
Algorithm PassFail
Define score As Real
Read score
If score >= 60 Then
Write "Passed"
Else
Write "Try again"
EndIf
EndAlgorithmPrint the even numbers from 2 to 20 using a loop.
Algorithm EvenNumbers
Define i As Integer
For i <- 2 To 20 Step 2 Do
Write i
EndFor
EndAlgorithmRead five numbers, add them and display their average.
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
EndAlgorithmShow a small menu and react to the option selected by the user.
Algorithm Menu
Define option As Integer
Read option
According To option Do
1: Write "Start"
2: Write "Help"
Otherwise: Write "Invalid option"
EndAccording
EndAlgorithmFollow the guide in order, then come back and solve these without copying the examples.