Write a program to compute simple interest and compound interest
Answers
Answered by
0
import java.util.*;
public class S.I._C.I.
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
double p,r,t,s,c;
System.out.println("Enter the principal");
p=in.nextDouble();
System.out.println("Enter the rate of interest");
r=in.nextDouble();
System.out.println("Enter the time");
t=in.nextDouble();
s=p*r*t/100;
System.out.println("The simple interest is"+s);
c=Math.pow((1+r/100),t)*p-p;
System.out.println("The compound interest is"+c);
}
}
Similar questions