1.Write a shell script to print below pattern

  #!/bin/bash

# Number of rows for the pattern

rows=4

# Loop through each row

for ((i=0; i<rows; i++)); do

    # Print numbers from 0 to i

    for ((j=0; j<=i; j++)); do

        echo -n "$j "

    done

    # Move to the next line after each row

    echo

done


Comments

Popular posts from this blog

3.Write a shell script to print below pattern 1 1 2 1 1 3 3 1