Example library
Pseudocode examples for learning to program
Short, explained programs grouped by topic and level. Each one comes with its code, its flowchart, a sample run and a challenge to keep practising.
For students
Read the code, see how it looks as a flowchart and compare it with the sample run. Then open it in Codoritmo, change it and solve the challenge.
For teachers
Every example has its own link to share in class or on your course platform. It opens straight in the editor, with nothing to install.
First steps
Your first algorithms: show messages, read input, keep values in variables and do simple calculations.
Hello World
Your first algorithm: print a couple of messages on screen.
BeginnerPersonal Greeting
Asks for your name and age, and answers with both.
BeginnerTemperature Converter
Converts degrees Celsius to Fahrenheit and Kelvin.
BeginnerTip Calculator
Splits a restaurant bill, tip included.
Beginner
Decisions
Programs that choose what to do with Si, SiNo and Segun: compare values, combine conditions and handle each case.
Can I Vote?
Tells you whether you can vote or how many years you have left.
BeginnerBody Mass Index
Computes your BMI and classifies it as underweight, normal and so on.
IntermediateParking Fee
Charges every started hour, with a daily maximum.
IntermediateLeap Year
Applies the calendar rules to tell whether a year is a leap year.
IntermediateCoffee Shop Menu
Pick a drink from the menu and get the total to pay.
Beginner
Loops
Repeat instructions with Mientras, Repetir and Para: count, add up, validate input and play until you guess.
Times Table
Prints the multiplication table for the number you choose.
BeginnerGuess the Number
Guess a secret number from 1 to 100 in seven tries.
IntermediatePassword Check
Keeps asking for a password until it has at least 8 characters.
BeginnerCountdown
A rocket launch countdown that ticks second by second.
BeginnerSum Until Zero
Adds up the numbers you type until you enter a 0.
BeginnerDrawing Shapes
Draws a square and a triangle with asterisks.
Intermediate
Arrays
Store many values under one name: walk through arrays and matrices, search, add up and find the largest.
Grade Average
Stores five grades in an array and finds the average and the highest.
BeginnerLinear Search
Finds a name in a list, ignoring upper and lower case.
IntermediateStore Inventory
Records the stock of each product and flags what to restock.
IntermediateWeekly Sales
A table of sales by branch and day, with totals.
AdvancedShopping List
Adds items to a list that grows until you type FIN.
Advanced
Sorting & searching
The classic sorting and searching algorithms, with their complexity: bubble, selection, insertion, merge, quick sort and binary search.
Bubble Sort
Sorts random numbers by swapping neighbors, and stops as soon as they're in order.
IntermediateSelection Sort
Finds the smallest of the remaining numbers and puts it in its place.
IntermediateInsertion Sort
Inserts each number among the sorted ones, like arranging cards in your hand.
IntermediateShell Sort
Insertion sort between far-apart elements, with a gap that shrinks every pass.
AdvancedMerge Sort
Splits the array in halves, sorts each one recursively and merges them.
AdvancedQuicksort
Picks a pivot, splits smaller from larger values and sorts each side recursively.
AdvancedHeap Sort
Arranges the array as a heap, then takes the largest out again and again.
AdvancedCounting Sort
Counts how many times each value appears, without comparing numbers.
IntermediateBinary Search
Finds a value in a sorted array by halving the range every step.
IntermediateLinear vs. Binary Search
Counts the comparisons each search needs on the same sorted list.
Intermediate
Text
Work with strings: measure, cut, join, reverse and count letters with the text functions.
Palindromes
Checks whether a phrase reads the same forwards and backwards.
IntermediateCount Vowels
Counts the vowels, spaces and other characters in a text.
IntermediateName Initials
Gets the initials of a full name.
BeginnerCaesar Cipher
Encrypts a message by shifting each letter of the alphabet.
AdvancedData Formatting
Fixes upper and lower case, and converts between text and numbers.
Intermediate
Subprocesses & functions
Split a program into SubProcesos and Funciones: parameters, return values, pass by reference and recursion.
Factorial and Power
Functions that compute a factorial and a power.
IntermediateBy Reference and by Value
Sorts three numbers by swapping them in subprocesses.
IntermediateReusable Validation
Validates the email and age on a sign-up form.
IntermediateModular Menu
A unit converter with a menu that keeps coming back.
IntermediateTowers of Hanoi
Solves the classic tower puzzle step by step.
Advanced
Math
Maths problems solved with algorithms: primes, divisors, greatest common divisor and more.
Prime Numbers
Finds every prime number up to a limit.
IntermediateGCD and LCM
Computes the greatest common divisor and the least common multiple.
IntermediateFibonacci Sequence
Prints the first terms of the Fibonacci sequence.
BeginnerQuadratic Equation
Solves ax² + bx + c = 0, with real or complex roots.
IntermediateRoman Numerals
Converts a number from 1 to 3999 into Roman numerals.
AdvancedBase Conversion
Writes a number in binary and hexadecimal.
AdvancedGeometry
Finds a circle's area and solves a right triangle.
IntermediateCompound Interest
Watch your savings grow year by year.
Intermediate
Projects
Longer programs that combine everything else: games and small complete applications.
Tic-Tac-Toe
The classic three-in-a-row game for two players.
AdvancedATM
Checks your PIN and lets you check, deposit and withdraw money.
AdvancedClass Grade Book
Records three grades per student and builds a class report.
AdvancedHangman
Guess a secret word letter by letter, with six mistakes allowed.
AdvancedContact Book
Add, list and search contacts in a book that grows.
Advanced