⓮C Program to calculate Simple Interest (With Program and Explanation)

๐Ÿ“ŒProgram to calculate Simple Interest

 Simple Interest Formula :-

Simple Interest (SI)=P×R×T100​

Where:

  • P = Principal amount

  • R = Rate of interest (per year)

  • T = Time (in years)


๐Ÿงพ C Program to Calculate Simple Interest

#include <stdio.h> int main() { float principal, rate, time, simpleInterest; // Taking input from the user printf("Enter Principal Amount: "); scanf("%f", &principal); printf("Enter Rate of Interest: "); scanf("%f", &rate); printf("Enter Time (in years): "); scanf("%f", &time); // Calculating Simple Interest simpleInterest = (principal * rate * time) / 100; // Displaying the result printf("Simple Interest = %.2f", simpleInterest); return 0; }

๐Ÿง  Explanation of the Program

1️⃣ Header File

#include <stdio.h>
  • This header file is used for input and output functions like printf() and scanf().


2️⃣ Variable Declaration

float principal, rate, time, simpleInterest;
  • principal → stores the principal amount

  • rate → stores the rate of interest

  • time → stores time in years

  • simpleInterest → stores the calculated SI

float is used to handle decimal values.


3️⃣ Taking Input

scanf("%f", &principal); scanf("%f", &rate); scanf("%f", &time);
  • These statements take values from the user.


4️⃣ Calculation

simpleInterest = (principal * rate * time) / 100;
  • Applies the Simple Interest formula.


5️⃣ Output

printf("Simple Interest = %.2f", simpleInterest);
  • Displays the result up to 2 decimal places.


๐Ÿ” Sample Output

Enter Principal Amount: 5000 Enter Rate of Interest: 5 Enter Time (in years): 2 Simple Interest = 500.00

✅ Key Points (For Blog Highlight)

  • Uses basic arithmetic

  • Beginner-friendly C program

  • Real-life application

  • Uses float for accuracy


๐Ÿ“ Conclusion

This program demonstrates how to calculate Simple Interest using simple arithmetic operations. 


๐Ÿ“˜ C Programming Series – What’s Next?

๐Ÿ‘‰ In the next post of this series, we will learn how to find area of a circle with complete explanation and output examples. Stay tuned! ๐Ÿš€

Comments

Popular posts from this blog

⑫ C Program to Swap Two Numbers Without Using a Temporary Variable (With Program and Explanation)

9️⃣C Program to Find LCM of Two Numbers (With Program and Explanation)