C Program to Calculate Simple Interest

Learn via video course
FREE
View all courses
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
Topics Covered

Simple interest is a fundamental financial concept that calculates the additional amount earned or paid on a principal sum over a period. This article discusses the calculation of simple interest in C programming and provides a clear guide to implementing its formula effectively.

Simple Interest Formula

Let's understand the formula to calculate the simple interest in the C language.

Mathematically

Where P is the principal amount, R is the rate of the interest, and the T is the total time of interest on the amount The units of rate are decimal or percentage The unit of t is years.

Logic to Calculate Simple Interest

Let's understand the logic of writing the simple interest program in C. To calculate simple interest, we must have the values of principal, rate, and total time of interest.

To calculate simple interest, we multiply all the given values and divide the result by 100. To get accurate, simple interest, we can store the result in the double data type because the double data type can efficiently store fractional and whole values.

Algorithm

Let's understand the algorithm to write the simple interest program in C.

  1. Store the values of the Principal, Time, and the Rate in the particular data types.
  2. Now, use this formula (P* R* T)/100 to calculate simple interest. The P is the principal, R is the rate of interest, and T is the total period of time.
  3. The calculated value from the above expression is the Simple interest.

C Program to Calculate Simple Interest

Let's understand how to calculate the simple interest program in C.

Output:

Time Complexity

The Time Complexity of the simple interest program in C is O(1) because all the operations for calculating the simple interest are constant.

Conclusion

  • The formula to find the simple interest in C language is (P*R*T)/100. The P is the Principal, R is the rate, and the T is the total interval time.
  • The Decimal representation of the simple interest is the most accurate.
  • The time complexity of finding the simple interest in the C language is O(1).