Ruby Programming Tutorial - Lesson 03 - Arithmetic Operations
ruby·@bilal-haider·
0.000 HBDRuby Programming Tutorial - Lesson 03 - Arithmetic Operations
 After learning basics of variables, I am sure now you have gained enough knowledge on how to store values inside of variables. Its time to play with variables and do some arithmetic operations on them. ## Addition , adding values together. ``` my_age = 27 number_of_years = 3 total_age = my_age + number_of_years print "Total Age = " print total_age ```  ## Subtraction , Removing value from a variable. ``` my_age = 27 number_of_years = 3 total_age = my_age - number_of_years print "Total Age = " print total_age ```  It is so lovely, how easily you can become older and younger :p by just adding and removing values in and out from your age .. ## Multiplication In this example, I am sharing with you, on how to multiply bitcoins it is very easy actually ``` bitcoins = 0.2 multiplication_factor = 3 total_bitcoins = bitcoins * multiplication_factor print "Total Bitcoins = " print total_bitcoins ``` # * Operator is used to multiply two numbers together.  more arithmetic operations, which you can try are Division, # / this operator is used for dividing numbers ``` bitcoins = 0.2 multiplication_factor = 3 total_bitcoins = bitcoins / multiplication_factor print "Total Bitcoins = " print total_bitcoins ``` ## I wish we could just add more friends in our lives just by using addition operator :) would be amazing. ## you can also use other operators, like modulus % , which is used to find reminder after division .. ## and exponential operators... you can do a little google search for more arithmetic operators. you should be writing some programs now, try to become as creative as you can... think about everything you want to add in .. and subtract from ... write a code for them.. ## Enjoy :)
👍 bilal-haider, jdcrunchman, marquitos, gmike, vannyfath, michaelwrites, bagindooo, hr1, spiry-btc, iqbalskm, glend, lockout, arpan01, lativhalaluna, nandagayo, kingsyrus, inertia, josagusdel, sherlie, rizael13, mrtimeless, realfaceoflife, randowhale, channelgam, rextj121, cryptoasis, lordfalcon, mbk19, monowar, arabbymajumder, derpdragon,