Write a program to find the compound interest
#include<stdio.h>
#include<conio.h>
void main()
{
float principal,netamount,rate,ci;
int time,year=1;
clrscr();
printf("Enter the principal time and rate of interest\n");
scanf("%f%d%f",&principal,&time,&rate);
netamount=principal;
while(year<=time)
{
netamount=netamount*(1+rate/100);
year++;
}
ci=netamount-principal;
printf("Compound Interest=%f\n",ci);
printf("Net amount=%f",netamount);
getch();
}
Output:
Enter the principal time and rate of interest
1000
5
8
Compound Interest=469.328125
Net amount=1469.328125
No comments: