java program 4

/*Write a java program that will compute the amount of interest that is earned on an investment over a period of 5 years. The value of the investment at the end of each year is output */

class fourth
{
public static void main(String ar[])
{
int p=1000;
float r=5.5f,PI=0.00f;

for(int i=1;i<=5;i++)
{
PI=p*r*i/100;
System.out.println("Amount of Interest of year "+ i +" is : "+PI);
}
}

}

0 comments:

Post a Comment