Today we shall write the script to calculate the simple interest for given amount. We use the same traditional formula which we used in your childhood i.e is ptr/100. To calculate SI we need to need the data about principal amount,rate of interest and time period. Let us start the script

echo “Enter the principal amount:”

read p

echo “Enter the rate of interest:”

read r

echo “Enter time period”

read t

i = ` expr $p \* $t \* $r`

i = ` expr $i / 100 `

echo ” Hence interest is $i “

output:

Enter the principal amount:1000

Enter the rate of interest:5

Enter the time period:2

Hence interest is:100

*
*

### Like this:

Like Loading...

*Related*