C Program for simple interest?


Simple Interest is the product of principal amount, rate of interest and the time duration (in years) by 100.

Example,

Input − p=5, r=4, t=5

Output − 1

Explanation: Simple Interest = (Principal Amount * Rate of Interest * Number of years) / 100

SI= 5*4*5/100 = 1

Example

#include<iostream>
#include <stdio.h>
using namespace std;
int main() {
   //principle amount
   float p = 5;
   //time
   float r = 4;
   //rate in years
   float t = 5;
   // Simple interest
   float SI = 0;
   SI =(p * t * r) / 100;
   printf("Simple Interest = %f ",SI);
   return 0;
}

Output

Simple Interest = 1.0000

Updated on: 09-Aug-2019

466 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements