Skip to content

Add simple-interest.sh calculator script#3

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-simple-interest-script
Draft

Add simple-interest.sh calculator script#3
Copilot wants to merge 3 commits intomainfrom
copilot/add-simple-interest-script

Conversation

Copy link

Copilot AI commented Jan 24, 2026

Implements a bash script to calculate simple interest from user-provided principal, rate, and time period inputs.

Implementation

  • Prompts for three inputs: principal amount, interest rate (per annum), and time period (years)
  • Calculates using formula: SI = (P × R × T) / 100
  • Uses bc for decimal arithmetic precision (scale=2)
  • Validates inputs are positive numeric values (integers or decimals)
  • Exits with error for invalid inputs (negative, non-numeric, or empty values)

Usage

$ ./simple-interest.sh
Enter the principal amount:
1000
Enter the rate of interest (per annum):
5
Enter the time period (in years):
2
Principal Amount: 1000
Rate of Interest: 5%
Time Period: 2 years
Simple Interest: 100.00
Original prompt

Create simple-interest.sh bash script to compute simple interest based on user input and the input fields like principal, rate of interst and time period.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 24, 2026 13:06
Co-authored-by: renatoalvesca <63110187+renatoalvesca@users.noreply.github.com>
Co-authored-by: renatoalvesca <63110187+renatoalvesca@users.noreply.github.com>
Copilot AI changed the title [WIP] Add simple interest shell script for calculation Add simple-interest.sh calculator script Jan 24, 2026
Copilot AI requested a review from renatoalvesca January 24, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants