Write a C program to input principle (amount), time and rate (P, T, R) from user and find Compound Interest. How to calculate compound interest in C programming if principle, time and rate are given by user. C program for Compound Interest.

Input principle (amount): 1200

Input time: 2

Input rate: 5.4

Output Compound Interest = 133.099197

P * ((1 + R / 100)

Happy coding ;)

**Example:**Input principle (amount): 1200

Input time: 2

Input rate: 5.4

Output Compound Interest = 133.099197

### Required knowledge

Fundamentals of C, Data types, Talking user input in C#### Compound Interest

Formula for finding compound interest can be given by:P * ((1 + R / 100)

^{T}- 1) (where P = Principle, T = Time, R = Rate)### Program

/** * C program to calculate Compound Interest */ #include <stdio.h> #include <math.h> int main() { float amount, rate, time, CI; // Reads amount, time and rate from user printf("Enter principle (amount): "); scanf("%f", &amount); printf("Enter time: "); scanf("%f", &time); printf("Enter rate: "); scanf("%f", &rate); // Calculates compound interest CI = amount * (pow((1 + rate / 100), time)-1); printf("Compound Interest = %f", CI); return 0; }

Output

Enter principle (amount): 1200

Enter time: 2

Enter rate: 5.4

Compound Interest = 133.099197

Enter time: 2

Enter rate: 5.4

Compound Interest = 133.099197

Happy coding ;)

### You may also like

- Basic programming exercises index.
- C program to calculate Simple Interest.
- C program to find area of rectangle.
- C program to find area of triangle.
- C program to calculate area of equilateral triangle.
- C program to calculate total, average and percentage.
- C program to check whether a character is alphabet or not.
- C program to check whether an alphabet is vowel or not.
- C program to check whether a character is alphabet, vowel or special character.
- C program to calculate profit or loss.

< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).