Java Program to Calculate Simple Interest

by | Jan 12, 2023 | Java, Java Programs

Introduction

A simple formula gives the Simple Interest:

Simple Interest = (Principal * Time * Rate of Interest) / 100

Where,

The principal Amount is the main sum of money you put in a bank. Time is the duration during which you want to calculate the interest generated and the Rate of the interest determines how much interest will be generated against the given principal.

Examples

Input:
P = 10,000
R = 5
T = 5
OUTPUT: 2500

The interest rate is 5%, the principal amount is 10,000, and the time is 5 years. On the basis of these numbers, we will have to find the simple interest.

Input:
P = 3000
R = 7
T = 1
OUTPUT: 210

Sample Code

//This is a program that shows how to calculate simple interest on a principal sum of money when //other details like rate of interest and time period are given
import java.io.*;
class Demo
{
public static void main (String args [])
{
//The required values to calculate SI
float P = 1, R = 1, T = 1;
//Mathematical formula to calculate SI
float SI = (P * T * R) / 100;
System.out.println (“Simple Interest = ” + SI);
}
}

 

OUTPUT

Simple Interest = 0.01

 

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.