Loading…
OS · Loops & numbers · Program 08 · In the record
write a shell script to input a term and print the Fibonacci Series of that term
1#!/bin/bash2 3echo "Enter the number of terms:"4read n5 6a=07b=18 9echo "Fibonacci Series of $n terms:"10 11for (( i = 1; i <= n; i++ ))12do13 echo -n "$a "14 c=$((a + b))15 a=$b16 b=$c17done18 19echo10Enter the number of terms: 10 Fibonacci Series of 10 terms: 0 1 1 2 3 5 8 13 21 34
Run program 08 in your browser
bash · just-bash. Change the code or the input, run it, break it, and see what happens.