Description
The formula to calculate simple interest is: simple interest = (principle x rate x time) / 100
C/C++
/* C Program to find simple interest */ //Save it as SimpleInterest.c #include<stdio.h> int main(){ float amount, rate, time, result; printf("Enter the amount : "); scanf("%f",&amount); printf("Enter the rate : "); scanf("%f",&rate); printf("Enter the time : "); scanf("%f",&time); result = (amount*rate*time)/100; printf("The simple interest is %.3f", result); return 0; }
Input: Enter the amount : 1200 Enter the rate : 5 Enter the time : 7 Output: The simple interest is 420.000
Java
/* Java Program to find simple interest */ //Save it as SimpleInterest.java import java.io.*; import java.util.Scanner; public class SimpleInterest { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); float amount, rate, time, result; System.out.println("Enter the amount : "); amount = scanner.nextFloat(); System.out.println("Enter the rate : "); rate = scanner.nextFloat(); System.out.println("Enter the time : "); time = scanner.nextFloat(); result = (amount*rate*time)/100; System.out.println("The simple interest is "+result); } }
Input: Enter the amount : 1200 Enter the rate : 5 Enter the time : 7 Output: The simple interest is 420.0
Related Programs
1) Program to calculate Permutation And Combination2) Program to calculate Gross Salary
3) Program to calculate Grade of Student
4) Program to find sum of digits of a number
5) Program to reverse a number
6) Program to convert Decimal to Binary
7) Program to find sum of first and last digit of a number
8) Program to find factors of a Number
9) Program to add two complex numbers
10) Program to Check Leap Year