1

In this article, you are going to learn how to write a C program to calculate Simple Interest in 2 ways. One is without using functions and another way is by using a user-defined function with arguments and return type.

## C Program to Calculate Simple Interest Logic:

Simple Interest = (Principal amount*rate*time)/100

Simply saying simple interest is calculated by multiplying principal value into the rate of interest into the duration of time divided by 100 gives you an amount of SI.

**Steps:**

First, declare the variables to store the values of PTR

Next enter the values for Principal amount which you want to calculate, for how much time you need to calculate in years and the rate of interest in percentage.

**Example:**

```
#include <stdio.h>
int main()
{
float princ, time, r, SI;
printf("Enter princ in rupees: ");
scanf("%f", &princ);
printf("Enter time in years: ");
scanf("%f", &time);
printf("Enter rate value: ");
scanf("%f", &r);
SI = (princ * time * r) / 100;
printf("Simple Interest for given values are = %f", SI);
return 0;
}
```

**Output:**

```
Enter princ in rupees: 1000
Enter time in months and days: 2
Enter rate value: 10
Simple Interest for given values are = 200.000000
```

Related: **Reverse a string in C**

**write a** **C Program to calculate Simple Interest using function with arguments and return type:**

```
#include<stdio.h>
float interest_calculate(float a, float b, float c);
int main()
{
float princi, periods , rates;
float res;
printf("\n Please Enter Prinicpal Amount in rupees:\t");
scanf("%f", &princi);
printf("\n Please Enter Periods of Years:\t");
scanf("%f", &periods);
printf("\n Please Enter Rate of Interest:\t");
scanf("%f", &rates);
res = interest_calculate(princi, periods, rates);
printf("\nSimple Interest = %f\n", res);
printf("\n");
return 0;
}
float interest_calculate(float a, float b, float c)
{
float si;
si = (a * b * c)/100;
return si;
}
```

**Output:**

```
Please Enter Principal Amount in rupees: 2000
Please Enter Period of Years: 5
Please Enter Rate of Interest: 2
Simple Interest = 200.000000
```

If you have any doubts or program is not compiling and getting errors please comment them in the comment section below. We will reply to you as soon as possible.

1