In this program, we are going to share how to calculate compound interest using C programming language. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to calculate compound interest.
Copy the below C program and execute it with the help of C compiler. At the end of this program, We have shared the output of this program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> #include <math.h> int main() { float principal, rate, year, ci; printf("Enter principal: "); scanf("%f", &principal); printf("Enter rate: "); scanf("%f", &rate); printf("Enter time in years: "); scanf("%f", &year); ci=principal*((pow((1+rate/100),year)-1)); printf("Compound interest is: %f\n",ci); return 0; } |
Enter principal: 1000
Enter rate: 5
Enter time in years: 1
Compound interest is: 49.999954
Liked this program? Do Like & share with your friends 🙂
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: C program to calculate Compound Interest, compound interest formula, compound interest program, compound interest program in c, compound interest program in c using for loop, compound interest program in c using function, write an algorithm to calculate compound interest