Logic to calculate compound interest
- Input principal amount. Store it in some variable say principle.
- Input time in some variable says time.
- Input rate in some variable says rate.
- Calculate compound interest using the formula,
CI = principle * pow((1 + rate / 100), time)
. - Finally, print the resultant value of ci.
#include <stdio.h>
#include <math.h>
void main()
{
float principle,rate,time,ci;
printf("Enter the value of principle,rate,time");
scanf("%f%f%f",&principle,&rate,&time);
ci=principle*(pow((1+rate/100),time));
printf("ci is =%f",ci);
}
Expected Output:-