Find Simple Interest. Inputs are principal amount, period in year and rate of interest.

This is one of the easiest programs, you will encounter while learning how to use arithmetic operators in a C program.

To calculate the simple interest, you must know the formula to calculate the simple interest. Don’t worry, if you don’t know the formula then read till the end.

Finding simple interest is quiet common in any institution such as banks, finance and so on. We also learned this while we were in school. πŸ˜‰

What is Simple Interest? πŸ€”

Simple Interest is the amount of interest charged on a sum at a given interest rate for a given period of time.

Unlike compound interest where the interest of previous year’s principal is added to calculate the interest of the next year.

In real life, you can relate this to the concept of borrowing money and the simple interest is calculated on the amount borrowed.

When we open a savings account in a bank and deposit some money in the account, the bank provides us interest on our money. The interest applied by the banks is of many types one of them is simple interest.

Let’s take an example, John borrows $1000 for 7 Years, at 6% simple interest:

Simple Interest = $1,000 Γ— 6% x 7 Years = $420 😎

Simple Interest Formula 🧠

The formula to calculate the simple interest is SI = (P * R * T) / 100, where P = Principal Amount, R = Rate of Interest and T = Time Period.

The amount of money lent/deposited is called Principal Amount. The money generated as a result of lending/depositing is called Interest.

Tutorial πŸ“Ί

Steps to find Simple Interest πŸͺœ

Let’s understand how we can find Simple Interest step by step.

  1. First of all, declare 4 floating point variables amt, rate, time and si to store the values of principal amount, interest rate, time or period (in years) and simple interest, respectively.
  2. Here, the purpose of declaring the variable si (simple interest) is to store the final result i.e. whatever the simple interest we find out, will be stored in this variable.
  3. Next, accept 3 values from the user which are principal amount, interest rate and time or period (in years). Store these values in their respective variables.
  4. Calculate the simple interest with the help of formula (si = (amt * rate * time) / 100) i.e. the main logic of the C program. Next, as shown in the formula, store the results in si variable.
  5. Once we store the simple interest in si variable, display the result with appropriate message.

Code πŸ’»

#include <stdio.h>
#include <conio.h>

int main()
{
  float si=0, amt=0, rate=0, time=0;
  // Display message and ask user to input principal amount
  printf("\nPlease enter the principal amount: ");
  scanf("%f", &amt); // input principal amount
  // Display message and ask user to input interest rate
  printf("\nPlease enter the interest rate: ");
  scanf("%f", &rate); // input interest rate
  // Display message and ask user to input time (in years)
  printf("\nPlease enter the time in years: ");
  scanf("%f", &time); // input period in year
  si = (amt * rate * time) / 100; // main logic of the program
  // Display the result
  printf("\n\nSimple interest = %0.2f\n\n", si);
  return 0;
}

Example 😍

Let’s imagine, the user enters principal amount as 2000, rate of interest as 10 and time = 5.

The simple interest is calculated by using its formula, SI = (2000 * 10 * 5) / 100. Simple interest will be calculated and stored in si i.e. 1000.

Finally, the result stored in variable si is displayed as:

Simple interest = 1000.00

This is how we calculate the simple interest in C language.
For more C Programs, click here.

Categorized in: