Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create CI.html #391

Merged
merged 4 commits into from
Oct 24, 2023
Merged
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
16 changes: 16 additions & 0 deletions Add Your Code Hs/CI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function calculateCompoundInterest() {
// Get input values
var principal = parseFloat(document.getElementById("principal").value);
var annualRate = parseFloat(document.getElementById("annualRate").value);
var compoundingFrequency = parseInt(document.getElementById("compoundingFrequency").value);
var years = parseInt(document.getElementById("years").value);

// Calculate compound interest
var amount = principal * Math.pow(1 + (annualRate / compoundingFrequency), compoundingFrequency * years);

// Round the result to two decimal places
amount = Math.round(amount * 100) / 100;

// Display the result
document.getElementById("result").innerHTML = "The final amount after " + years + " years is: $" + amount;
}
11 changes: 11 additions & 0 deletions Add Your Code Hs/Percentage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function calculatePercentage() {
// Get input values
var number = parseFloat(document.getElementById("number").value);
var percentage = parseFloat(document.getElementById("percentage").value);

// Calculate the result
var result = (number * percentage) / 100;

// Display the result
document.getElementById("result").innerHTML = percentage + "% of " + number + " is " + result;
}
Loading