
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
Java Program to Calculate Simple Interest
In this article, we will understand how to calculate the simple interest. Simple Interest is calculated using the following formula, If Principal = P, Rate = R% per annum, Time = T years:
Simple Interest (S.I) = P * T * R / 100
Simple Interest − The percentage interest on total principal amount. Returns are less compared to Compound Interest.
Below is a demonstration of the same −
Input
Suppose our input is −
Enter a Principle number : 100000 Enter a Interest rate : 5 Enter a Time period in years : 2
Output
The desired output would be −
Simple Interest : 1000
Algorithm
Step 1 – START Step 2 – Declare four float values principle, rate, time, simple_interest Step 3 – Read values of principle, rate, time, from the user Step 4 – Perform "(principle*rate*time)/100" to calculate the simple interest and store it in a simple_interest variable Step 8 – Display simple_interest Step 10 – STOP
Example 1
Here, the input is being entered by the user based on a prompt. You can try this example live in ourcoding ground tool .
import java.util.Scanner; public class SimpleInterest{ public static void main (String args[]){ float principle, rate, time, simple_interest; System.out.println("Required packages have been imported"); Scanner my_scanner = new Scanner(System.in); System.out.println("A my_scanner object has been defined "); System.out.print("Enter a Principle number : "); principle = my_scanner.nextInt(); System.out.print("Enter a Interest rate : "); rate = my_scanner.nextInt(); System.out.print("Enter a Time period in years : "); time = my_scanner.nextInt(); simple_interest = (principle*rate*time)/100; System.out.println("The Simple Interest is : " + simple_interest); } }
Output
Required packages have been imported A Scanner object has been defined Enter a Principle number : 10000 Enter a Interest rate : 5 Enter a Time period in years : 2 The Simple Interest is : 1000.0
Example 2
Here, the integer has been previously defined, and its value is accessed and displayed on the console.
public class SimplInterest{ public static void main (String args[]){ float principle, rate, time, simple_interest; principle = 100000; rate = 5; time = 2; System.out.printf("The Principle amount is %f \nThe interest rate is %f \nThe time period in years is %f " , principle, rate, time); simple_interest = (principle*rate*time)/100; System.out.println("\nThe Simple Interest is: " + simple_interest); } }
Output
The Principle amount is 100000.000000 The interest rate is 5.000000 nThe time period in years is 2.000000 The Simple Interest is: 1000.0
- Related Articles
- Java Program to calculate Simple Interest and Compound Interest
- Swift Program to Calculate Simple Interest
- Kotlin Program to Calculate Simple Interest
- Swift Program to Calculate simple interest and compound interest
- Haskell 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
- Java Program to calculate Compound Interest
- Java Program to Calculate the Compound Interest
- How to Calculate Simple Interest using Golang code?
- JavaScript Program to find simple interest
- Simple interest in Python Program
- Python Program for simple interest
- C Program for simple interest?
- Swift Program to Calculate Compound Interest

Advertisements