Arithmetic operators in BASH scripting

අද කතා කරන්නේ Basic Arithmetic operators ටික ගැන. ඒ කියන්නෙ එකතු කිරීම, අඩු කිරීම , බෙදීම , ගුන කිරීම.

ඔයාල දැන් දන්නවනේ කොහොමද bash script file එකක් හදාගන්නෙ කියල.. දන්නෙ නැති අය මෙ Link එක Use කරල ඔක්කොම ටික බලන්න - https://binurayeshan.blogspot.com

හරි දැන් ඔයාලා හදා ගත්ත script file එකේ මෙන්න මේ code line ටික type කරන්න.

#!/bin/bash

a=2
b=5
c=9

echo "$a,$b,$c"

echo "Sum of variable are = $[a+b+c]" #එකතු කිරිම්

echo "Value of c MOD b = $[c%b] " #mod එක ඒ කියන්නෙ බෙදුවම එන ඉතිරිය

echo "Value of c MOD b = $[c-b] " #අඩු කිරීම

echo "Value of a * c = $[a*c]" #ගුණ කිරීම

echo "Value of c / b = $[c/b]"  #බෙදීම


Comments

Popular posts from this blog

Lets talk about bash script

Logical Operators in bash script(And, OR, NOT)