Skip to content

Commit 2a3b643

Browse files
authored
Create simple-interest.sh
1 parent f4e5aa3 commit 2a3b643

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

simple-interest.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# This script calculates simple interest given principal, annual rate of interest and time period in years.
3+
# Do not use this in production. Sample purpose only.
4+
5+
# Author: Upkar Lidder (IBM)
6+
# Addtional Authors:
7+
# <your Github username>
8+
9+
# Input:
10+
# p, principal amount
11+
# t, time period in years
12+
# r, annual rate of interest
13+
14+
# Output:
15+
# simple interest = p*t*r
16+
17+
echo "Enter the principal:"
18+
read p
19+
echo "Enter rate of interest per year:"
20+
read r
21+
echo "Enter time period in years:"
22+
read t
23+
24+
s=$(expr $p \* $t \* $r / 100)
25+
echo "The simple interest is: "
26+
echo $s

0 commit comments

Comments
 (0)