Answers for "Java program to find simple interest"

1

Java program to find simple interest

// Java program to find simple interest
import java.util.Scanner;
public class SimpleInterestJavaProgram
{
   public static void main(String[] args)
   {
      float principal, rate, time;
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter principal amount : ");
      principal = sc.nextFloat();
      System.out.print("Please enter rate annually : ");
      rate = sc.nextFloat();
      System.out.print("Please enter time(in years) : ");
      time = sc.nextFloat();
      float simpleInterest;
      simpleInterest = (principal * time * rate) / 100;
      System.out.println("The Simple Interest is : " + simpleInterest);
      sc.close();
   }
}
Posted by: Guest on December-10-2020
0

simple interest in java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        // simple interest

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter principal amount: ");
        float principal = scanner.nextFloat();

        System.out.print("Enter time in years: ");
        float time = scanner.nextFloat();

        System.out.print("Enter rate: ");
        float rate = scanner.nextFloat();

        float simpleInterest = (principal * time * rate) / 100;

        System.out.println("The simple interest is " + simpleInterest);
    }
}
Posted by: Guest on June-25-2021

Code answers related to "Java program to find simple interest"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language