Computer Science, asked by np916872, 5 months ago

. W.A.P. to input principal, rate and time. Calculate and display the difference between Simple

Interest (SI) and Compound Interest (CI) by using function argument.​

Answers

Answered by sugeshdev033
0

Explanation:

java and c program is a correct answer buddy

Answered by SaitamaOPM
0

Answer: Using JAVA:

import java.util.*;

public class diff_SI_CI { // Class diff_Si_ci begins

   public static void main(String[]args){ // Main begin

       int principal, rate, time;

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter The Principal: ");

       principal = sc.nextInt();

       System.out.println("Enter the Rate: ");

       rate = sc.nextInt();

       System.out.println("Enter the Time: ");

       time = sc.nextInt();

       int SimpleInterest = principal*rate*time/100;

       double a = principal* Math.pow((1.0+rate/100.0),time);

       double CompoundInterest = a - principal;

       double difference = CompoundInterest- SimpleInterest;

       System.out.println(difference);

   }

}

Explanation:

If You don't want to take amount (a) as Double you have to cast to int:

Eg:  int a = (int) principal* Math.pow((1+rate/100),time);

Attachments:
Similar questions