Shell Script to Print Numbers in Descending Order - The Coding Shala

Home >> Scripting >> Descending order of a number

Shell Script to Print Numbers in Descending Order

Write a shell script to print numbers in descending order using a while loop?

Code: 

#!/bin/bash
i=5
while test  $i != 0
do 
echo "$i"
i=`expr $i - 1`
done



Other Posts You May Like
Please leave a comment below if you like this post or found some error, it will help me to improve my content.

Comments

Popular Posts from this Blog

N-th Tribonacci Number Solution - The Coding Shala

Time Complexity, Space Complexity, Asymptotic Notations - The Coding Shala

Java Method Overloading - The Coding Shala

Graph Representation using Adjacency Matrix - The Coding Shala

Shell Script to find sum, product and average of given numbers - The Coding Shala