WAP in Java to input Principal(p), Rate(r), Time(t). Calculate and display the amount, which is compounded annually for each year by using the formula:
Simple Internet (si) =prt/100
p=p+si
Answers
Answered by
20
import java.util.*;
public class brainiliest
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter principle");
double p =sc.nextDouble();
double pcopy = p;
System.out.println("Enter rate of interest");
doubler=sc.nextDouble();
System.out.println("Enter time period of investement");
double t= sc.nextDouble();
int i;
double si;
for(i=1;i<=t;i++)
{
si = (p*r*t)/100.0;
p=p + si;
}
double amt = si + pcopy;
System.out.println("The amount is="+amt);
}
}
Similar questions