ADVERTISEMENT
ADVERTISEMENT

Java program to calculate Simple Interest

Simple Interest in Java - This program will read Principal, Rate and Time from the user and calculate the Simple Interest.

Simple Interest using Java Program

//Java program to calculate Simple Interest.
import java.util.*;
 
public class SimpleInterest{
 
    public static void main(String []args)
    {
        double p=0,r=0,t=0,si=0;
         
        //Scanner class to take user input.
        Scanner X = new Scanner(System.in);
         
        System.out.print("Enter Principle : ");
        p = X.nextFloat();
         
        System.out.print("Enter Rate of Interest: ");
        r =  X.nextFloat();
         
        System.out.print("Enter Time in years : ");
        t =  X.nextFloat();
         
        //Formula of simple interest.
        si = (p*r*t)/100;
         
        System.out.print("Simple Interest is :"+si+"\n");
                 
    }
}

Output

    [email protected]:~$ javac SimpleInterest.java 
    [email protected]:~$ java SimpleInterest 

    Enter Principle : 10000
    Enter Rate of Interest: 10
    Enter Time in years : 1
    Simple Interest is :1000

Core Java Example Programs »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.