여기서 우리는 하나의 C 프로그램을 작성하여 복리 이자를 얻는 방법을 볼 것입니다. 논리는 매우 쉽습니다. 여기에 몇 가지 매개변수가 필요합니다 -
- P - 원리금
- R − 이자율
- T - 시간 범위
복리식은 아래와 같습니다.

예시
#include<stdio.h>
#include<math.h>
float compoundInterest(float P, float T, float R) {
return P*(pow(1+(R/100), T));
}
int main() {
float p, t, r;
printf("Enter Princple amount, rate of interest, and time: ");
scanf("%f%f%f", &p, &r, &t);
printf("Interest value: %f", compoundInterest(p, t, r));
} 출력
Enter Princple amount, rate of interest, and time: 5000 7.5 3 Interest value: 6211.485352