1. Home
  2. /
  3. Chapel
  4. /
  5. Factorial Calculator

Factorial Calculator - Chapel Typing CST Test

Loading…

Factorial Calculator — Chapel Code

Calculates factorial of a number using recursion.

proc factorial(n: int): int {
	if n == 0 then return 1;
	return n * factorial(n-1);
}
writeln(factorial(5));

Chapel Language Guide

Chapel is a parallel programming language designed for high-performance computing (HPC). Developed by Cray Inc., it provides productivity features for writing scalable and portable parallel programs, combining high-level abstractions with fine-grained control over concurrency and data distribution.

Primary Use Cases

  • ▸High-performance computing (HPC) applications
  • ▸Scientific simulations and modeling
  • ▸Data-intensive parallel processing
  • ▸Algorithm prototyping for supercomputers
  • ▸Education in parallel and distributed programming

Notable Features

  • ▸Global-view programming model for distributed memory
  • ▸Task and data parallelism support
  • ▸Domain maps for data distribution
  • ▸High-level abstractions with optional low-level control
  • ▸Portability across HPC platforms

Origin & Creator

Developed by Cray Inc. as part of the Cray Cascade project, first released in 2009.

Industrial Note

Chapel is mainly used in research, supercomputing centers, and scientific computing environments requiring scalable parallel execution.

More Chapel Typing Exercises

Chapel Counter and Theme ToggleChapel Fibonacci SequenceChapel Prime CheckerChapel Sum of ArrayChapel Reverse StringChapel Multiplication TableChapel Celsius to FahrenheitChapel Simple Alarm SimulationChapel Random Walk Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher