Loading…
OS · Decisions · Program 29 · In the record
shell script to print the largest of three input numbers
1#!/bin/bash2 3echo "Enter three numbers:"4read a b c5 6if (( a >= b && a >= c ))7then8 largest=$a9elif (( b >= a && b >= c ))10then11 largest=$b12else13 largest=$c14fi15 16echo "Largest of $a, $b and $c = $largest"15 42 27Enter three numbers: 15 42 27 Largest of 15, 42 and 27 = 42
Run program 29 in your browser
bash · just-bash. Change the code or the input, run it, break it, and see what happens.