Loading…
OS · Functions & patterns · Program 25 · In the record
Write the shell script to print the following pattern after input term #n=3
1#!/bin/bash2# For n = 3:3# 14# 1 25# 1 2 36 7echo "Enter the number of terms:"8read n9 10for (( i = 1; i <= n; i++ ))11do12 for (( j = 1; j <= i; j++ ))13 do14 echo -n "$j "15 done16 echo17done3Enter the number of terms: 3 1 1 2 1 2 3
Run program 25 in your browser
bash · just-bash. Change the code or the input, run it, break it, and see what happens.