Saturday, September 12, 2015

Calcualate Simple Interest using java

/*
*Write a C program to find the Simple Interest. Take input for principle amount, rate of interest and time
*from terminal.
*Simple Interest is the money paid by the borrower to the lender, based on the Principle Amount, Interest
*Rate and the Time Period.
*Simple Interest is calculated by, SI= P * T * R / 100 formula.
*Where, P is the Principle Amount.
*T is the Time Period.
*R is the Interest Rate.
*/
package cb_pr175;
import java.util.Scanner;

public class Cb_pr175 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner inp=new Scanner(System.in);
        int pa,ye;
        float rate,si;
        System.out.println("Enter your principal amount");
        pa=inp.nextInt();
        System.out.println("Enter your number of year");
        ye=inp.nextInt();
        System.out.println("Enter your rate of interest");
        rate=inp.nextFloat();
        si=(rate*pa)*ye;
        System.out.println("Your total interest is " + si);
       
    }

}

1 comment: