Program to find simple interest

Description

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
The formula to calculate simple interest is:
simple interest = (principle x rate x time) / 100
The formula to calculate simple interest is: simple interest = (principle x rate x time) / 100
The formula to calculate simple interest is:
simple interest = (principle x rate x time) / 100

C/C++

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/* 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;
}
/* 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; }
/* 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;
}
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Input:
Enter the amount : 1200
Enter the rate : 5
Enter the time : 7
Output:
The simple interest is 420.000
Input: Enter the amount : 1200 Enter the rate : 5 Enter the time : 7 Output: The simple interest is 420.000
Input:
Enter the amount : 1200
Enter the rate : 5
Enter the time : 7

Output:
The simple interest is 420.000

Java

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/* 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);
}
}
/* 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); } }
/* 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);
    }
}
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Input:
Enter the amount :
1200
Enter the rate :
5
Enter the time :
7
Output:
The simple interest is 420.0
Input: Enter the amount : 1200 Enter the rate : 5 Enter the time : 7 Output: The simple interest is 420.0
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 Combination
2) 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
Share Me

Leave a Reply