SHELL PROGRAM
Write a program to find the largest number from three numbers ? | Shell Program |
#!/bin/bash
echo "Enter first number"
read first
echo "Enter second number"
read sec
echo "Enter third number"
read third
if [ $first -gt $sec ]; then
if [ $first -gt $third ]; then
echo "$first is greatest number"
else
echo "$third is greatest number"
fi
else
if [ $sec -gt $third ]; then
echo "$sec is greatest number"
else
echo "$third is greatest number"
fi
fi
OUTPUT
Enter first number
10
Enter second number
30
Enter third number
15
30 is greatest number
echo "Enter first number"
read first
echo "Enter second number"
read sec
echo "Enter third number"
read third
if [ $first -gt $sec ]; then
if [ $first -gt $third ]; then
echo "$first is greatest number"
else
echo "$third is greatest number"
fi
else
if [ $sec -gt $third ]; then
echo "$sec is greatest number"
else
echo "$third is greatest number"
fi
fi
OUTPUT
Enter first number
10
Enter second number
30
Enter third number
15
30 is greatest number
Post a Comment
0 Comments