এই প্রোগ্রামটির মাধ্যমে একজন শিক্ষার্থী ডাটা টাইপের ব্যাবহার এবং While লুপ নিয়ে কাজ করা শিখতে পারবে । আউটপুটকে কিভাবে ২ টি কলামে/সারিতে আলাদা করে প্রিন্ট করা যায় তাও এখানে আছে । প্রোগ্রামটি পাটিগনিতের সহজ অংকের প্রতিফলন। এখানে একজন ব্যাক্তির ৫০০০ টাকার বিনিয়োগের বিপরীতে প্রতি বছরে ১১% হারে সুদ সংযুক্ত করলে বছর শেষে তার কত টাকা সুদে-আসলে দাঁড়াবে তা নির্নয় করা হয়েছে । এভাবে ১ম থেকে ১০তম বছর পর্যন্ত টাকাটি বিনিয়োগ হতে থাকলে ১০ তম বছর শেষে তার মোট মূলধন কত দাড়াবে তাও এই প্রোগ্রামটির মাধ্যমে নির্নয় করা যাবে ।
Problem: Write a program which calculates the value of money at the end of each year of investment.
Hints: Assuming an interest rate of 11 percent and prints the year and the corresponding amount, in two columns. The sample output is shown below for a period of 10 years with an initial investment of 5000.00. The program uses the following formula:
value at end of year = Value at start of year (1+ interest rate)
Source Code:
#include<stdio.h>
#define PERIOD 10
#define PRINCIPAL 5000.00
main()
{
int year;
float amount,value,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:
0 5000.00
1 5550.00
2 6160.50
-
-
-
10 14197.11
<< Go to Index Page >>
#include
উত্তরমুছুন#include
main()
{
int year,i;
float amount,value,inrte;
printf("Enter time period (in year): ");
scanf("%d",&year);
printf("Enter the amount: ");
scanf("%f",&amount);
printf("Enter interest rate (in percent): ");
scanf("%f",&inrte);
inrte=inrte/100;
for(i=0;i<=year;i++)
{
printf("%2d %0.2f\n",i,amount);
value = amount+inrte*amount;
amount = value;
}
}
#include"stdio.h"
উত্তরমুছুনmain(){
printf("Interest is prohibited in Islam!");
int d,r,y,total;
printf("\n\n\nEnter the capital amount :\n");
scanf("%d",&d);
printf("Enter rate of interest :\n");
scanf("%d",&r);
printf("Enter the number of year :\n");
scanf("%d",&y);
r=(r*10)/100;
total=d*r*y;
printf("The total interest amount is %d\n",total);
}
#include
উত্তরমুছুনmain()
{
printf("money of investment");
int a,b,c,r,result;
printf("\n\Enter the first num:\n");
scanf("%d",&a);
printf("Enter the percent of interest:\n");
scanf("%d",&b);
printf("Enter the investment:\n");
scanf("%d",&c);
r=(r*10)/100;
result=a*b*c;
printf("The result interest amount is%d\n",result);
}
#include"stdio.h"
উত্তরমুছুনmain(){
printf("Investment amount");
int a,b,c,total;
printf("\n\n\nEnter the capital amount :\n");
scanf("%d",&a);
printf("Enter rate of interest :\n");
scanf("%d",&b);
printf("Enter the number of year :\n");
scanf("%d",&c);
b=(b*10)/100;
total=a*b*c;
printf("The total interest amount is %d\n",total);
}
#include
উত্তরমুছুনmain()
{
printf("money of investment");
int a,b,c,r,result;
printf("\n\Enter the first num:\n");
scanf("%d",&a);
printf("Enter the percent of interest:\n");
scanf("%d",&b);
printf("Enter the investment:\n");
scanf("%d",&c);
r=(r*10)/100;
result=a*b*c;
printf
#include
উত্তরমুছুন#include
void main()
{
float p,rate,time,si;
printf("Enter principal amount : ");
scanf("%f", &p);
printf("Enter rate of interest : ");
scanf("%f", &rate);
printf("Enter time period in year : ");
scanf("%f", &time);
si=(p*time*rate)/100;
printf("\nSimple Interest = %2f",si);
}
sonia ferdusi
উত্তরমুছুনid-201410285
#include
void main()
{
int capital,rate,year,intotal;
cout("enter the capital balance:\n");
cin("%d",&capital);
cout("enter the interest:\n");
cin("%d",&rate);
cout("enter the no of year:\n");
cin("d",&year);
rate=(rate*10)/100;
intotal=capital*rate*year;
cout("the intotal interest is %d\n",intotal);
}
#include
উত্তরমুছুন#include
main()
{
int r,j,n:
cout<<"Enter The Principle amount";
cin>>p;
cout<<"Enter Rate of Interest";
cin>>r;
cout<<"Enter Number of Year;
cin>>n;
{
p+=p*(r/100);
}
cout<<"The Current amount"<<n<<Year is:"<<p;
}
উত্তরমুছুনRubel(201410530)
main()
{
printf("Net Amount");
int a,b,c,total;
printf("\n\n\n enter the capital amount:\n");
scanf(%d", &a);
printf("Enter rate of interest:\n");
scanf(%d",&b);
printf("enter the no of year:\n");
scanf("%d",c);
b=(b*10)/100;
total=a*b*c;
printf("the total interest amount is%d\n",total)
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int price,percent,year,interest ;
cout<<"Enter Principle : ";
cin>>price;
cout<<"Enter Rate : ";
cin>>percent;
cout<<"Enter Time : ";
cin>>year;
interest =(price*percent*year)/100;
cout<<"Simple interest is : "<<interest ;
return 0;
}
//md.abul kashem
উত্তরমুছুন//roll-201410856
//45th
#include
using namespace std;
float calc(float s, char c, float y);
float sqr(float s);
int main()
{
float q,r,ch;
char c;
cin>>q>>c>>r;
cout<<"Press 1 for Calculator and Press 2 for Square"<>ch;
if (ch==1) calc(q,c,r);
else if(ch==2) cout<<sqr(q);
else cout<<"Enter valid charecter"<<endl;
}
float sqr(float s)
{
return s*s;
}
float calc(float q, char c, float r)
{
if (c=='+')
cout<<"Addition="<<q+r<<endl;
else if(c=='-') cout<<"subtraction="<<q-r<<endl;
else if(c=='*')cout<<"multiplication="<<q*r<<endl;
else if(c=='/')cout<<"Devision="<<q/r<<endl;
else cout<<"Enter valid charecter"<<endl;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int year, period, principal;
float inrate, total;
cout<<"What's the amount of your principal: ";
cin>>principal;
cout<>period;
cout<>inrate;
cout<<endl;
float amount = principal;
for(year=0; year<=period; year++){
cout<<endl<<"year"<<year<<" "<<amount;
total= amount+amount*inrate;
amount=total;
}
return 0;
}
using c++
উত্তরমুছুন#include
#define PERIOD 10
#define PRINCIPAL 5000
using namespace std;
main()
{
int a,v,i,sum;
cout<<"Enter the amount";
cin>>a;
cout<<"Enter the value";
cin>>v;
cout<<"Enter the inrate";
cin>>i;
sum=a*v*i/100;
cout<<a*v*i/100<<sum;
}
using C++
উত্তরমুছুন#include
#define PERIOD 10
#define PRINCIPAL 5000
using namespace std;
main()
{
int a,v,i,sum;
cout<<"Enter the amount";
cin>>a;
cout<<"Enter the value";
cin>>v;
cout<<"Enter the inrate";
cin>>i;
sum=a*v*i/100;
cout<<a*v*i/100<<sum;
}
shah syed mohammad fehir ID:201520314
উত্তরমুছুন#include
using namespace std;
int main()
{
float I,t,PV;
cout<<"please input principal value:";
cin>>PV;
cout<<"please input time:";
cin>>t;
cout<<"please input interest:";
cin>>I;
cout<<PV*t*I/100;
}
#include
উত্তরমুছুনusing namespace std;
int main ()
{
int r,p,n;
float inrate,total;
cout<<"Enter the principl amount:";
cin>>p;
cout<<"Enter rate of interest:";
cin>>r;
cout<<"Enter number of year:";
cin>>n;
p=p*(r/100);
cout<<"The amount"<<n<<"Year is"<<p;
return 0;
}
Appel mahmud akib Id:201510384
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b,t;
cout<<"Input Investment value: ";
cin>>a;
cout<<"input percent of Interest: ";
cin>>b;
cout<<"Input Time: ";
cin>>t;
cout<<Interest of principle amount<<(a*b*t)/100;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int a,b;
char op;
cout<<"Input two integer with oparator: ";
cin>>a>>op>>b;
switch(op)
{
case'+':
cout<<a+b;
break;
case'-':
cout<<a-b;
break;
case'*':
cout<<a*b;
break;
case'/':
cout<<a/b;
break;
defeault:
cout<<"Invalid input";
break;
}
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int c,d;
char op;
cout<<"Input two integer with oparator: ";
cin>>c>>op>>d;
switch(op)
{
case'+':
cout<<c+d;
break;
case'-':
cout<<c-d;
break;
case'*':
cout<<c*d;
break;
case'/':
cout<<c/d;
break;
defeault:
cout<<"Invalid input";
break;
}
}
using c++
উত্তরমুছুন#include
using namespace std;
double func(float money, float interest, int time)
{
int t;
float total;
interest = interest/100;
for (t = 0; t < time; t++){
total = money + (money*interest);
money = total;
}
return money;
}
int main()
{
float i, j;
int k;
cout << "Enter total ammount of money --: ";
cin >> i;
cout << "Enter interest in parcent (%) value --: ";
cin >> j;
cout << "Enter time for your money --: ";
cin >> k;
cout << "Total amount of money with interest --:" << func(i, j, k);
return 0;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int i, interest, year, total, money;
cout << "Enter your interest value: ";
cin >> interest;
cout << "Enter total ammount: ";
cin >> money;
cout << "Enter you time: ";
cin >> year;
interest = interest/100;
for(i=0; i<= year; i++){
total = money + (interest*money);
money = total;
cout << "Total amount is: "<<money;
}
return 0;
}
using C++
উত্তরমুছুন#include
using namespace std;
int main()
{
int i,t,a,sum;
cout<<"Enter The amount";
cin >>a;
cout<<"Enter The interest";
cin >>i;
cout<<"Enter The time";
cin >>t;
sum =a*i*t/100;
cout<<a*t*i/100<<sum;
return 0;
}
using c++
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b;
char op;
cout<<"Input two integer with oparator: ";
cin>>a>>op>>b;
switch(op)
{
case'+':
cout<<a+b;
break;
case'-':
cout<<a-b;
break;
case'*':
cout<<a*b;
break;
case'/':
cout<<a/b;
break;
defeault:
cout<<"Invalid input";
break;
}
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int i;
double investment, interest, year, total;
cout <<"Enter your investment: "<< endl;
cin >> investment;
cout <<"Enter your interest: "<< endl;
cin >> interest;
cout <<"Enter your year: "<< endl;
cin >> year;
interest = interest/100;
for(i=1; i < year+1; i++)
{
total = investment+(investment*interest);
investment = total;
if(i>1){
cout << "interest for " << i << " years total is: " << investment <<"\n";
}
else{
cout <<"interest for " << i << " year total is: " << investment <<"\n";
}
}
return 0;
}
id: 201510992
#include
উত্তরমুছুনusing namespace std;
int main()
{
int a,b,t,c;
cout<<"Input Investment value: "<>a;
cout<<"input percent of Interest: "<>b;
cout<<"Input Time: "<>t;
c=(a*b*t)/100;
cout<<"Interest of principle amount :" <<c<<endl;
}
mausumi sumi
উত্তরমুছুন#include
using namespace std;
int main(){
int a,b,c,t;
cout<<"input investment value"<<a;
cout<<"input percent of interest"<<b;
cout<<"input time"<<t;
c=(a*b*t)/100;
cout<<"interest of principle amount"<<c<<endl;
}
#include
উত্তরমুছুনmain()
{
printf("money of investment");
int a,b,c,r,result;
printf("\n\Enter the first num:\n");
scanf("%d",&a);
printf("Enter the percent of interest:\n");
scanf("%d",&b);
printf("Enter the investment:\n");
scanf("%d",&c);
r=(r*10)/100;
result=a*b*c;
printf("The result interest amount is%d\n",result);
}