Computer Science, asked by aisha001, 6 months ago

2) Write a Java code to find the difference between Simple Interest (SI) and Compound
Interest (CI) when - Principal = 150000, Rate of interest = 10% and Time period = 2
years​

Answers

Answered by anindyaadhikari13
4

Question:-

➡ Write a Java code to find the difference between Simple Interest (SI) and Compound

Interest (CI) when - Principal = 150000, Rate of interest = 10% and Time period = 2 years.

Program:-

class Difference

{

public static void main(String x[])

{

double p=150000, r=10,t=2;

double si=p*r*t/100.0;

double a=p*Math.pow(1+r/100.0,t);

a=a-p; // Now, a = CI earned in 2years.

double diff=si-a;

System.out.println("Difference between simple interest and compound interest is: "+diff);

}

}

Answered by BrainlyProgrammer
2

Answer:

class Interest

{

public static void main(String ar[])

{

int p=150000;

double r=10; //As it is 10% and 10/100=0.10

int t=2

double si=(p*r*t)/100; //Calculating SI

double ci= p*(Math.pow((1+(r/100)), t) -1) ;

System.out.println("Difference="+(ci-si)) ;

}

}

Explanation:

Note:

The direct formula of ci without finding amount is

CI=P(((1+R/100)^T)-1)

Similar questions