💡 Code Examples

Learn from real-world pseudocode examples

Factorial Calculator

Algorithm Factorial

var n = 5
var fact = 1

For i = 1 To n
    fact = fact * i
Endfor

Print "Factorial:", fact

Endalgorithm

Fibonacci Sequence

Algorithm Fibonacci

var count = 10
var a = 0, b = 1

For i = 1 To count
    Print a
    var next = a + b
    a = b
    b = next
Endfor

Endalgorithm

Prime Number Checker

Algorithm PrimeChecker

var num = Input "Enter number:"
var isPrime = true

For i = 2 To num - 1
    If num mod i == 0 Then
        isPrime = false
    Endif
Endfor

Print "Is Prime:", isPrime

Endalgorithm

Array Operations

Algorithm ArrayDemo

var numbers[5]

For i = 0 To 4
    numbers[i] = i * 10
Endfor

For i = 0 To Size(numbers) - 1
    Print numbers[i]
Endfor

Endalgorithm

Grade Calculator

Algorithm GradeCalc

var score = Input "Score:"

If score >= 90 Then
    Print "Grade: A"
Elseif score >= 80 Then
    Print "Grade: B"
Elseif score >= 70 Then
    Print "Grade: C"
Else
    Print "Grade: F"
Endif

Endalgorithm

Functions

Algorithm FunctionDemo

Function add(a, b)
    Return a + b
Endfunction

var x = 5, y = 10
var sum = add(x, y)

Print "Sum:", sum

Endalgorithm

Want More Examples?

Download iPseudo IDE to access comprehensive example files included with the app

Download iPseudo IDE