Showing posts with label biggest of three numbers. Show all posts
Showing posts with label biggest of three numbers. Show all posts

Shell Programming - biggest of given three numbers

# Shell Programming
# Biggest of three numbers

echo -n "Enter three numbers : "
read a b c

if [ $a -gt $b ]

then

if [ $a -gt $c ]
then
echo "Biggest is $a"

else
echo "Biggest is $c"
fi

else
if [ $b -gt $c ]
then
echo "Biggest is $b"

else
echo "Biggest is $c"
fi

fi

Function, biggest of three numbers

# Function - biggest of three numbers

def fn_big(x,y,z):
    if (x >= y and x >= z):
        return x
    elif (y >= x and y >= z):
        return y
    else:
        return z
    return max(x,y,z)

num1 = int(input("Enter number :"))
num2 = int(input("Enter number :"))
num3 = int(input("Enter number :"))

big = fn_big(num1, num2, num3)
print("biggest of three numbers is :", big)

# Function - biggest of three numbers

def fn_big(x,y,z):
    return max(x,y,z)

num1 = int(input("Enter number :"))
num2 = int(input("Enter number :"))
num3 = int(input("Enter number :"))

big = fn_big(num1, num2, num3)
print("biggest of three numbers is :", big)