Go to Top

Friday, 1 April 2011

To calculate Simple Interest (S.I.)

Question 4 : Write a program in Java to calculate Simple Interest (Principal, Rate, & Time to be given by the user).


Java Program :


class simple_interest
{
 public static void main(int p,int r,int t)
 {
     int si;
     si=(p*r*t)/100;
     System.out.print("The Simple interest on Rs. "+p+" for "+t+" year/s at "+r+"% rate of interest = Rs. "+si);
    }
}

Input :


p=100
r=10
t=1

Output :


The Simple interest on Rs. 100 for 1 years at 10% rate of interest = Rs. 10

1 comment:

  1. java programs showing on net is very much helpful for us,the students

    ReplyDelete

ShareThis