C Program

Write a program to calculate simple interest.


// Simple Interest Calculation

#define PERIOD 10
#define PRINCIPAL 5000.00

main() {
int year;
float amount;
float value;
float inrate;

amount = PRINCIPAL;
inrate = 0.11;
year = 0;

while(year <= PERIOD) {
printf("%2d   %8.2f\n", year, amount);

value = amount + inrate * amount;
year = year + 1;
amount = value;
}
}

Output :

Post a Comment

0 Comments