The program asks user to enter value of principle (p), rate (r) and time (t) and finally calculates the compound interest by following formula.
Write a C program to input principle (amount), time and rate (P, T, R) and find Compound Interest. How to calculate compound interest in C programming. Logic to calculate compound interest in C program.
#include<stdio.h>
#include<conio.h>
void main()
{
float p, r, t, comp;
printf("Enter the principle :");
scanf("%f", &p);
printf("Enter the rate :");
scanf("%f", &r);
printf("Enter the time :");
scanf("%f", &t);
comp = p * pow((1 + r / 100), t) - p;
printf("\nThe compound interest is %0.2f", comp);
getch();
}