Simple interest program in C
For example:
Input | Result |
---|---|
Principle | 1200 |
Time | 2 |
Rate | 5.2 |
Simple interest program in C
To make this program we need to understand what is simple interest and how to calculate simple interest.
What is simple interest?
It is a way to calculate the interest charges on a loan.
What is a principal?
The total amount of money borrowed (or invested), not including any interest or dividends
Formula
S.I = PTR/100
Code
#include<stdio.h>
int main(){ float p, t, si, r;
printf("Enter principal: "); scanf("%f", &p); printf("Enter rate in percentage: "); scanf("%f", &r); printf("Enter time in years: "); scanf("%f", &t);
si = (p * r * t)/100; printf("%.2f",si); return 0;}
Explanation: If you know the formula of simple interest and know how to use arithmetic operator in C language then you can easily make a program of simple interest.
In this program, we are storing the value to the respected variables and then writing the formula in float data type. After this, we are printing the formula.