C Program To Find Simple Interest
Simple interest is a quick method of calculating the interest charge on a loan. In this article, we will learn to calculate the simple interest in C programming language.
Simple interest is determined by multiplying the daily interest rate by the principal by the number of days that elapse between payments. Divide the product of these three values to convert the percentage value of the interest rate into decimals.
Simple Interest Formula
Where P is the principal amount, T is the time, and, R is the interest rate.
Simple Interest Program in C
C
// C program to implement // the above approach #include <stdio.h> // Driver code int main() { // We can change values here for // different inputs float P = 1, R = 1, T = 1; // Calculate simple interest float SI = (P * T * R) / 100; // Print Simple Interest printf ( "Simple Interest = %f\n" , SI); return 0; } // This code is contributed by agarwalsajal19. |
Output
Simple Interest = 0.010000
Complexity Analysis
- Time Complexity: O(1)
- Auxiliary Space: O(1)
Contact Us