[postlink]
http://uknow-iknow.blogspot.com/2016/09/dev-c-simple-in-bank.html[/postlink]
#include<iostream>
#include <cstdlib>
using namespace std;
int main()
{
int n, sub = 0;
char ch;
double Acc, rate, ra, to, presvalue;
do
{
system("cls");
cout<<"Amount of Money : ";cin>>presvalue;
cout<<"During(Month) : ";cin>>n;
cout<<"Rate for a Month : ";cin>>ra, cout<<endl;
Acc=(float)presvalue/n;
cout<<" Month \tPresent Value \tAccumalate\tRate\t\t\tTotal"<<"\n";
for(int i = 1;i<=n;i++){
rate = presvalue * ra;
if(presvalue>=Acc)
{
to = Acc + rate;
}
else
{
to = presvalue + rate;
}
sub =sub+to;
cout<<" "<<i;
cout<<"\t"<<presvalue<<"\t\t"<<Acc<<"\t\t"<<rate<<"\t\t\t"<<to<<endl;
cout<<"--------------------------------------------------------------------------"<<endl;
presvalue = presvalue - Acc;
}
cout<<"\t\t\t\t\t\t\tSubTo :\t"<<sub<<endl;
cout<<"--------------------------------------------------------------------------";
cout<<"\nDo you want to try again ? (y/n) : "; cin>>ch;
}while(ch=='y');
return 0;
}
this is result :
#include <cstdlib>
using namespace std;
int main()
{
int n, sub = 0;
char ch;
double Acc, rate, ra, to, presvalue;
do
{
system("cls");
cout<<"Amount of Money : ";cin>>presvalue;
cout<<"During(Month) : ";cin>>n;
cout<<"Rate for a Month : ";cin>>ra, cout<<endl;
Acc=(float)presvalue/n;
cout<<" Month \tPresent Value \tAccumalate\tRate\t\t\tTotal"<<"\n";
for(int i = 1;i<=n;i++){
rate = presvalue * ra;
if(presvalue>=Acc)
{
to = Acc + rate;
}
else
{
to = presvalue + rate;
}
sub =sub+to;
cout<<" "<<i;
cout<<"\t"<<presvalue<<"\t\t"<<Acc<<"\t\t"<<rate<<"\t\t\t"<<to<<endl;
cout<<"--------------------------------------------------------------------------"<<endl;
presvalue = presvalue - Acc;
}
cout<<"\t\t\t\t\t\t\tSubTo :\t"<<sub<<endl;
cout<<"--------------------------------------------------------------------------";
cout<<"\nDo you want to try again ? (y/n) : "; cin>>ch;
}while(ch=='y');
return 0;
}
this is result :