/*SIMPLE AND COMPOUND INTREST*/
import java.io.*;
Class intrest
{public static void main(string
args[])
{
try
{DataInputStream get=new DataInputStream(System.in);
System.out.println(“principal
amount,rate,number of years”);
int p=Integer.parseInt(get.readLine());
int
n=Integer.parseInt(get.readLine());
float
r=Float.parseFloat(get.readLine());
double si=(p*n*r)/100;
System.out.println(“compound
intrest=”+si);
double
ci=(p*Math.pow((1+r/100),n)-p);
System.out.println(“compound
intrest=”+ci);
}
Catch(exception e)
{
System.out.println(“error found”);
}
}
}






0 comments:
Post a Comment