In the realm of finance, Simple Interest (SI) and Compound Interest (CI) are pivotal concepts used in various financial transactions, loans, investments, and savings. The C programming language provides a robust platform to comprehend and compute these interests effectively. Understanding the calculations behind these interest types is fundamental for financial literacy.

## Table of Contents

## Problem Statement

WAP that calculates the Simple Interest and Compound Interest. The Principal, Amount, Rate of Interest, and Time are entered through the keyboard.

## Simple Interest (SI):

Simple interest is calculated on the principal amount for a specified duration at a fixed rate. The formula for simple interest is:

**Simple Interest (SI)= P×R×T / 100**

Where:

- P = Principal amount
- R = Rate of interest per annum
- T = time in years

## Compound Interest (CI):

Compound interest encompasses interest on the principal amount along with the accumulated interest from previous periods. The formula for compound interest is:

**Compound Interest (CI)= P×(1+R/100)^{T}−P**

Where:

- P = Principal amount
- R = Rate of interest per annum
- T = time in years

## Implementing Simple Interest and Compound Interest Calculation in C

Let’s create a C program that allows users to input the principal amount, rate of interest, and time, and then calculate both simple interest and compound interest.

```
#include <stdio.h>
#include <math.h>
float calculate_simple_interest(float principal, float rate, float time) {
float simple_interest = (principal * rate * time) / 100;
return simple_interest;
}
float calculate_compound_interest(float principal, float rate, float time) {
float compound_interest = principal * (pow((1 + rate / 100), time)) - principal;
return compound_interest;
}
int main() {
float principal_amount, rate_of_interest, time_period;
printf("Enter the principal amount: ");
scanf("%f", &principal_amount);
printf("Enter the rate of interest: ");
scanf("%f", &rate_of_interest);
printf("Enter the time period (in years): ");
scanf("%f", &time_period);
// Calculate Simple Interest and Compound Interest
float simple_interest = calculate_simple_interest(principal_amount, rate_of_interest, time_period);
float compound_interest = calculate_compound_interest(principal_amount, rate_of_interest, time_period);
// Displaying the results
printf("\nSimple Interest: %.2f\n", simple_interest);
printf("Compound Interest: %.2f\n", compound_interest);
return 0;
}
```

### Output

This Above C program prompts the user to input the principal amount, rate of interest, and time. It then computes and displays both simple interest and compound interest based on the provided inputs.

By utilizing this C program, users can efficiently compute both simple and compound interests.

## 1 thought on “Simple Interest and Compound Interest in C”