1. Home
  2. /
  3. Fortran
  4. /
  5. Counter and Theme Toggle

Counter and Theme Toggle - Fortran Typing CST Test

Loading…

Counter and Theme Toggle — Fortran Code

Demonstrates a simple counter with theme toggling using Fortran variables and console output.

program Counter
	integer :: count = 0
	logical :: isDark = .false.

	print *, 'Counter:', count
	print *, 'Theme:', merge('Dark','Light',isDark)

	! Increment counter
	count = count + 1
	print *, 'Counter:', count

	! Toggle theme
	isDark = .not. isDark
	print *, 'Theme:', merge('Dark','Light',isDark)

	! Decrement counter
	count = count - 1
	print *, 'Counter:', count

	! Reset counter
	count = 0
	print *, 'Counter:', count
end program Counter

Fortran Language Guide

Fortran (Formula Translation) is a high-level, compiled programming language designed for numeric computation, scientific computing, and engineering applications. Known for its efficiency in numerical calculations, Fortran has been a standard in scientific computing for over 60 years.

Primary Use Cases

  • ▸Scientific simulations
  • ▸Numerical and matrix computations
  • ▸High-performance computing
  • ▸Weather & climate modeling
  • ▸Finite element analysis
  • ▸Computational physics & chemistry

Notable Features

  • ▸Efficient numerical computation
  • ▸Array-oriented syntax
  • ▸Strong support for parallelism (OpenMP, MPI)
  • ▸Modern Fortran supports OOP
  • ▸Backward compatible across decades of standards

Origin & Creator

Fortran was developed in the 1950s by IBM engineers led by John Backus to simplify programming of numeric computations on early computers.

Industrial Note

Fortran is heavily used in computational fluid dynamics, weather modeling, numerical simulations, high-performance computing (HPC), aerospace, and energy industry applications.

More Fortran Typing Exercises

Fortran Simple AdditionFortran FactorialFortran Fibonacci SequenceFortran Max of Two NumbersFortran Array SumFortran Even Numbers FilterFortran Conditional Counter IncrementFortran Resettable CounterFortran Theme Toggle Only

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher