Write a Java program to calculate simple interest.

Q.8 Write a Java program to calculate simple interest.

Solution  :- 

import java.util.*;
class SimpleInterest
{
    public static void main(String args[])
    {
    
     Scanner in = new Scanner(System.in);
     System.out.println(“Enter the Principle amount :-“);
    double principle = in.nextDouble();
    System.out.println(“Enter the Rate of interest :-“);
    double rate = in.nextDouble();
    System.out.println(“Enter the Time period  :-“);
    double time = in.nextDouble();
    double sp = principle * rate * time/100;
    System.out.println(“The simple interset is :- “+sp);
    }
}

Output :- 

Leave a Reply

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

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.