A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fibonacci in Nim page! Here, you'll find the source code for this program as well as a description of how the program works.
# Fibonacci Sample Program in Nim # Input the number of iterations as a command-line parameter import os import strutils var n: BiggestUInt try: n = paramStr(1).parseBiggestUInt except IndexError, ValueError: echo "Usage: please input the count of fibonacci numbers to output" quit(1) var previouspreviousInt: BiggestUInt var previousInt: BiggestUInt = 0 var currentInt: BiggestUInt = 1 if n == 0: echo "" quit(0) for i in 1..n: echo i, ": ", currentInt previouspreviousInt = previousInt previousInt = currentInt currentInt = previouspreviousInt + previousInt
Fibonacci in Nim was written by:
If you see anything you'd like to change or update, please consider contributing.
Note: The solution shown above is the current solution in the Sample Programs repository as of Oct 16 2019 23:58:35. The solution was first committed on Oct 16 2019 20:14:08. As a result, documentation below may be outdated.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.