Comparing Numbers

Sort by

recency

|

250 Discussions

|

  • + 0 comments

    My Code is Following but can't able to pass test case from 1 to 5 only 2/7 test cases passed . I can't find the issue? Guide me. Thanks

    !/bin/bash

    Give two interger

    read -p "first interger" x

    read -p "second interger" y

    if [[ y ]] then echo " X is less then Y " elif [[ y ]] then echo " X is greater then Y " else echo "X is equal to Y" fi

  • + 0 comments
        read X
        read Y
    
        if (( X > Y )); then 
                echo "X is greater than Y"
        elif (( X == Y )); then 
                echo "X is equal to Y"
        elif (( X < Y )); then 
                echo "X is less than Y"
        fi
    
  • + 0 comments

    read X read Y if (( "X" > "Y" )); then echo "X is greater than Y " fi

    if (( "X" == "Y" )); then echo "X is equal to Y" fi

    if (( "X" < "Y" )); then echo "X is less than Y" fi

  • + 0 comments

    read X read Y if ((XY)); then echo "X is greater than Y" fi if ((X==Y)) ; then echo "X is equal to Y" fi

  • + 0 comments
    read X
    read Y
    if [[ $X -lt $Y ]]
    then
    echo "X is less than Y"
    elif [[ $X -gt $Y ]]
    then
    echo "X is greater than Y"
    else
    echo "X is equal to Y"
    fi