google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a program to find the difference between Simple Interest and Compound Interest when Principal, Rate and Time are given.

Write a program to find the difference between Simple Interest and Compound Interest when Principal, Rate and Time are given.

0

public class ashish
{
        public static void main(String args[])
        {
                int p,t;
               
                double r,si,amt,ci,d;
                d=0;
                p=5000;
                r=10;
                t=2;
                amt=p*(Math.pow(1+r/100,t));
                ci=amt-p;
                si=p*r*t/100;
                d=ci-si;
               
                System.out.println("The compound intrest ="+(float)ci);
                System.out.println("The simple intrest ="+si);
                System.out.println("difference between C.I. & S.I.="+(float )d);
       
        }
}

Expected Output:
The compound intrest =1050.0
The simple intrest =1000.0

difference between C.I. & S.I.=50.0

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top