Computer Science, asked by prateekgupta19844, 1 day ago

write a Java Program for to enter principal amount, rate of interest and time. Calculate and print the Simple interest and compound interest and difference between them.
Who will answer totally correct I will mark as brainliest​

Answers

Answered by boratakshitreddy672
0

Answer:

import java.util.Scanner;

public class JavaExample

{

public static void main(String args[])

{

float p, r, t, sinterest;

Scanner scan = new Scanner(System.in);

System.out.print("Enter the Principal : ");

p = scan.nextFloat();

System.out.print("Enter the Rate of interest : ");

r = scan.nextFloat();

System.out.print("Enter the Time period : ");

t = scan.nextFloat();

scan.close();

sinterest = (p * r * t) / 100;

System.out.print("Simple Interest is: " +sinterest);

}

}

Answered by kajalpal1975
0

Answer:

import java.util.Scanner;

public class Interest {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double p, r, t, si, ci, diff;

System.out.print("Enter principal: ");

p = sc.nextFloat();

System.out.print("Enter rate of interest: ");

r = sc.nextFloat();

System.out.print("Enter time: ");

t = sc.nextFloat();

si = (p*r*t)/100;

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

diff = ci-si;

System.out.println("\nSimple Interest = "+si);

System.out.println("Compound Interest = "+ci);

System.out.println("Difference = "+diff);

}

}

Run

Enter principal: 50000

Enter rate of interest: 5

Enter time; 2

Simple Interest = 5000.0

Compound Interest = 5125.0

Difference = 125.0

Please mark me as the brainiest

Similar questions