We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Linux Shell
  3. Bash
  4. The World of Numbers
  5. Discussions

The World of Numbers

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

Sort 168 Discussions, By:

recency

Please Login in order to post a comment

  • thinhproee
    1 week ago+ 0 comments
    #!/bin/bash
    
    # Read the input integers
    read a
    read b
    
    # Calculate sum, difference, product, and quotient
    sum=$((a + b))
    difference=$((a - b))
    product=$((a * b))
    quotient=$((a / b))
    
    # Print the results
    echo "$sum"
    echo "$difference"
    echo "$product"
    echo "$quotient"
    
    1|
    Permalink
  • batzorig_byamba1
    1 month ago+ 2 comments

    I think is better solution

    #!/bin/bash
    read num1
    read num2
    for x in {+,-,'*','/'}
    do
            echo "$(($num1$x$num2))"
    done
    
    1|
    Permalink
  • Krishna_Nani
    1 month ago+ 0 comments

    read x read y

    echo "x+((y))" echo "x*((y))"

    0|
    Permalink
  • TarangKr
    2 months ago+ 0 comments
    read num1
    read num2
    echo "$(($num1+$num2))"
    echo "$(($num1-$num2))"
    echo "$(($num1*$num2))"
    echo "$(($num1/$num2))"
    
    0|
    Permalink
  • TarangKr
    2 months ago+ 0 comments

    Using simple for loop

    read num1
    read num2
    for x in {$num}
    do
        echo "$(($num1+$num2))"
        echo "$(($num1-$num2))"
        echo "$(($num1*$num2))"
        echo "$(($num1/$num2))"
    done
    
    0|
    Permalink
Load more conversations

Need Help?


View tutorial
View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy