SI and CI

Once pls run it raa, i modified it
mail@pastecode.io avatar
unknown
java
a year ago
753 B
3
Indexable
import java.util.*;
public class akvs {
    public static void main(String[] args) throws Exception
    {
        Scanner read = new Scanner(System.in);
        int principle_amount, time_period;
        float rate_of_interest, simpleInterest, compoundInterest;
        principle_amount = read.nextInt();
        time_period = read.nextInt();
        rate_of_interest = read.nextFloat();
        simpleInterest = principle_amount * time_period * rate_of_interest / 100;
        compoundInterest = (principle_amount * (float)Math.pow(1 + rate_of_interest/100, time_period)) - principle_amount;
        System.out.printf("Simple Interest:%.6f\n",simpleInterest);
        System.out.printf("Compound Interest:%.6f",compoundInterest);
    }
}