Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
44 changes: 23 additions & 21 deletions simple-interest.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
#!/bin/bash
# This script calculates simple interest given principal, annual rate of interest and time period in years.
# Do not use this in production. Sample purpose only.
#!/bin/bash
# This script calculates simple interest given principal,
# annual rate of interest and time period in years.

# Author: Upkar Lidder (IBM)
# Addtional Authors:
# <your Github username>
# Do not use this in production. Sample purpose only.

# Input:
# p, principal amount
# t, time period in years
# r, annual rate of interest
# Author: Upkar Lidder (IBM)
# Additional Authors:
# <your GitHub username>

# Output:
# simple interest = p*t*r
# Input:
# p, principal amount
# t, time period in years
# r, annual rate of interest

echo "Enter the principal:"
read p
echo "Enter rate of interest per year:"
read r
echo "Enter time period in years:"
read t
# Output:
# simple interest = p*t*r

s=$(expr $p \* $t \* $r / 100)
echo "The simple interest is: "
echo $s
echo "Enter the principal:"
read p
echo "Enter rate of interest per year:"
read r
echo "Enter time period in years:"
read t

s=`expr $p \* $t \* $r / 100`
echo "The simple interest is: "
echo $s