May 14, 2013

C++ program to calculate compound interest by simple interest

#include<iostream.h>
#include<conio.h>
void main()
{
long float interest, prince, rate, amt;
int time, temp, r;
char choice;
do
{
clrscr ();
cout<<"PLEASE ENTER THE PRINCIPAL AMOUNT : ";
cin>>prince;
cout<<"\nENTER THE RATE OF INTEREST : ";
cin>>rate;
cout<<"\nENTER THE TIME : ";
cin>>time;
amt=prince;
cout<<"\n\tTIME\tSIMPLE INTEREST\tAMOUNT";
for(r=8, temp=0,interest=0;temp<=time;temp++, r++)
{
cout<<"\n\t"<<temp<<"\t"<<interest;
gotoxy(33,r);
cout<<amt;
interest=(amt*rate)/100;
amt=amt+interest;
}
cout<<"\n\tClosing"<<"\t"<<interest;
cout<<amt;
cout<<"\n\nTHUS, THE FINAL AMOUNT IS : "<<amt;
cout<<"\n\nREPEAT? (y/n) : ";
cin>>choice;
if(choice=='n'||choice=='N')
cout<<"\nTHANK YOU";
getch();
}while(choice=='y'||choice=='Y');
}

0 comments:

Post a Comment