1. Home
  2. /
  3. Algol
  4. /
  5. Prime Checker

Prime Checker - Algol Typing CST Test

Loading…

Prime Checker — Algol Code

Checks if a number is prime.

begin
	integer num, i;
	boolean isPrime;
	num := 13;
	isPrime := true;
	for i := 2 step 1 until num-1 do
	begin
		if num mod i = 0 then
		begin
		isPrime := false;
		goto end_loop;
		end;
	end;
end_loop:
	if isPrime then print("Prime") else print("Not Prime");
end

Algol Language Guide

ALGOL (Algorithmic Language) is a family of high-level programming languages designed for scientific computations and algorithm description, known for its structured programming features and influence on modern languages like Pascal, C, and Java.

Primary Use Cases

  • ▸Scientific computations
  • ▸Algorithm description in publications
  • ▸Academic teaching of programming and algorithms
  • ▸Mathematical modeling
  • ▸Compiler research and language design

Notable Features

  • ▸Block-structured programming
  • ▸Nested procedures and lexical scoping
  • ▸Call by name and call by value parameter passing
  • ▸Structured control flow: if, for, while
  • ▸Formal syntax specification (BNF)

Origin & Creator

Developed in 1958-1960 by a committee of European and American computer scientists, including Friedrich L. Bauer, John Backus, and Peter Naur.

Industrial Note

ALGOL was the standard language for publishing algorithms in scientific literature for decades and shaped the syntax and structure of many subsequent languages.

More Algol Typing Exercises

ALGOL Counter and Theme ToggleALGOL Fibonacci SequenceALGOL Factorial CalculatorALGOL Sum of ArrayALGOL Reverse StringALGOL Multiplication TableALGOL Temperature ConverterALGOL Simple Alarm SimulationALGOL Random Walk Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher