shell scripting for simple interest

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

Advertisement

About Anuroop D

Very enthusiastic about technology and likes to share my knowledge through blogging. Has Bachelor's in Information Technology and currently pursuing my PhD in Computer Science.
This entry was posted in Shell scripting and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s