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.
- Prepare
- Linux Shell
- Bash
- The World of Numbers
- Discussions
The World of Numbers
The World of Numbers
+ 0 comments read x read y echo $(($x + $y)) echo $(($x - $y)) echo $(($x * $y)) echo $(($x / $y))
+ 0 comments read a; read b;
echo ((a - b)); echo ((a / b));
+ 0 comments read x read y if (($x<-100)) && (($x>100)) || (($y<-100)) && (($y>100)) then echo "over range" exit 1 else #Sum echo $(($x+$y)) #difference echo $(($x-$y)) #product echo $(($x*$y)) #quotient echo $(($x/$y)) fi
+ 1 comment read x; read y; echo x+((y)); echo x*((y));
+ 2 comments For some reason this code works in my local terminal
read x read y expr $x + $y expr $x - $y expr $x \* $y expr $x / $y
But
fails two test cases. Can anyone explain, why?
Load more conversations
Sort 159 Discussions, By:
Please Login in order to post a comment