Answers for "interest code in java"

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 "interest code in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language