1. Home
  2. /
  3. Ada
  4. /
  5. Factorial

Factorial - Ada Typing CST Test

Loading…

Factorial — Ada Code

Calculates factorial recursively.

with Ada.Text_IO; use Ada.Text_IO;
procedure Factorial is
	function Fact(N: Integer) return Integer is
	begin
		if N <= 1 then
		return 1;
		else
		return N * Fact(N-1);
		end if;
	end Fact;
begin
	Put_Line("Factorial 5: " & Integer'Image(Fact(5)));
end Factorial;

Ada Language Guide

Ada is a statically typed, high-level programming language designed for safety-critical, real-time, and concurrent systems. Developed with reliability and maintainability in mind, Ada emphasizes strong typing, modularity, exception handling, and support for concurrent programming.

Primary Use Cases

  • ▸Safety-critical avionics systems
  • ▸Real-time embedded software
  • ▸Railway signaling and control
  • ▸Defense and military software
  • ▸Medical device software
  • ▸High-integrity systems requiring formal verification

Notable Features

  • ▸Strong static typing and compile-time checks
  • ▸Support for tasking (concurrency)
  • ▸Exception handling and robust error management
  • ▸Package-based modularity
  • ▸Design-by-contract with pre/post conditions

Origin & Creator

Ada was commissioned by the U.S. Department of Defense in the late 1970s and early 1980s, designed by Jean Ichbiah and his team at CII Honeywell Bull under the name 'Ada' in honor of Ada Lovelace.

Industrial Note

Ada is essential in avionics, railway control systems, nuclear power plant software, medical devices, and mission-critical defense applications where software failure is unacceptable.

More Ada Typing Exercises

Ada Counter and Theme ToggleAda Simple AdditionAda Fibonacci SequenceAda Max of Two NumbersAda List SumAda Even Numbers FilterAda Conditional Counter IncrementAda Resettable CounterAda Theme Toggle Only

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher