![]() |
VOOZH | about |
Write a C program to find the simple interest.
Simple Interest is the interest paid on the principal amount for which the interest earned regularly is not added to the principal amount.
Examples
Input: Principal = 1000, Rate = 5, Time = 2
Output: Simple Interest = 100Input: Principal = 2000, Rate = 3.5, Time = 4
Output: Simple Interest = 280
To find the simple interest in the C programming language, we can directly implement the simple interest formula with the required values such as rate, time, and principal amount as input since there is no built-in C function to calculate it directly.
Simple Interest = Principal * Rate * Timeβ / 100
Simple Interest = 0.010000
Time Complexity: O(1)
Auxiliary Space: O(1)
We can also define a function name smpInt() that takes rate, time and principle as arguments at returns the simple interest. It is more convenient when we need to find the simple interest frequently.
Simple Interest: 1200.00
Time Complexity: O(1)
Auxiliary Space: O(1)