- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing

- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM

- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers

- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources

# JavaScript Program to find simple interest

We will use the formula for simple interest to calculate the interest for a given principal amount, rate of interest, and time period. Simple interest is calculated as the product of the principal amount, rate of interest, and time period. This formula makes it easy for us to find the interest amount without having to calculate the compound interest.

In our JavaScript program, we will take input from the user for the principal amount, rate of interest, and time period, and then use the formula to calculate the simple interest. We will then display the result to the user.

By using this JavaScript program, we will be able to calculate simple interest quickly and easily for different sets of inputs, making it convenient for us to analyze and compare investment options.

## Approach

Simple interest is calculated by multiplying the principal amount, interest rate and time period.

Take the inputs for principal amount (p), interest rate (r) and time period (t).

Calculate the interest by using the formula

**"p * r * t"**.Add the interest to the principal amount.

Store the result in a variable.

Display the result.

End the program.

## Example

Here is a complete JavaScript program to calculate simple interest, along with explanations of the code −

// Define the variables to store the principal, rate of interest, and time var p = 1000; // Principal amount var r = 0.05; // Rate of interest var t = 2; // Time in years // Calculate the interest using the formula // Simple Interest = (principal * rate * time) / 100 var interest = (p * r * t) / 100; // Display the result console.log("Simple Interest: " + interest);

## Explanation

We first declare three variables

**p, r,**and**t**to store the principal amount, rate of interest, and time in years, respectively.Next, we use the formula for simple interest,

**(principal * rate * time) / 100**, to calculate the interest and store it in a variable**interest**.Finally, we use the

**console.log()**method to display the result on the console.

- Related Articles
- Java Program to calculate Simple Interest and Compound Interest
- Swift Program to Calculate simple interest and compound interest
- Kotlin Program to calculate Simple Interest and Compound Interest
- C++ Program to Calculate simple interest and compound interest
- Haskell Program to Calculate simple interest and compound interest
- Java Program to Calculate Simple Interest
- Swift Program to Calculate Simple Interest
- Kotlin Program to Calculate Simple Interest
- Python Program for simple interest
- Simple interest in Python Program
- C Program for simple interest?
- Compare simple interest and compound interest.
- Explain Simple Interest.
- What is Simple Interest?
- Golang Program to Compute Simple Interest Given all the Required Values