Calculate simple interest

Simple interest calculator

C Programming

int main() {
int p,t;
float r,si;
printf("Enter principal,time and rate: ");
si = p * t * r / 100;
printf("Simple Interest = %.2f",si);
return 0;

C++ Programming

using namespace std;
int main() {
int p,t;
float r;
cout << "Enter principal, time and rate: ";
cin >> p >> t >> r;
float si = p * t * r / 100;
printf("Simple Interest = %.2f",si);
return 0;

Java Programming

import java.util.Scanner;
class SimpleInterest {
public static void main(String args[]) {
int p,t;
float r,si;
Scanner sc = new Scanner(;
System.out.print("Enter principal, time and rate: ");
p = sc.nextInt();
t = sc.nextInt();
r = sc.nextFloat();
si = p * t * r / 100;
System.out.println("Simple interest = "+si);

Go lang

package main
import "fmt"
func main() {
var p,t int32
var r float32
fmt.Print("Enter principal, time and rate: ")
si := float32(p) * float32(t) * r / float32(100)
fmt.Println("Simple Interest: ",si)



<!doctype html>
<title>Sum of two numbers</title>
<form method="post" action="doSum.php">
<p>Principal: <input type="text" name="p"></p>
<p>Rate: <input type="text" name="r"></p>
<p>Time: <input type="number" name="t"> (In year) </p>
<p><input type="submit" name="sub" value="Calculate Simple Interest"></p>


if(isset($_POST['sub'])) {
$p = $_POST['p'];
$r = $_POST['r'];
$t = $_POST['t'];
$si = $p * $t * $r / 100;
echo "Simple Interest = ".$si;


Popular posts from this blog

Program to calculate telephone bill

Arrays in C Language

String in golang

Sum of two numbers in go lang

Pointers in C Language

Decision Making Statements

Say Hello world in Go lang

Decision Making in Go lang

Program to convert time from seconds to hours, minutes and seconds

Installing go lang