Ma Linn Latt Sandar Myint (Assignment2) PDF
Ma Linn Latt Sandar Myint (Assignment2) PDF
Ma Linn Latt Sandar Myint (Assignment2) PDF
Roll no-1801
Assignment2-C++
1. #include <iostream>
int main(){
int var1,var2;
cin>>var1>>var2;
if(var1>var2){
}else{
cout<<"\nSum ="<<var1+var2<<endl;
cout<<"Difference ="<<var1-var2<<endl;
cout<<"Product ="<<var1*var2<<endl;
cout<<"Ratio ="<<(var1*1.0F)/var2<<endl;
return 0;
2. #include <iostream>
#include<iomanip>
int main(){
int n;
cout<<setfill('-')<<setw(50)<<'-'<<endl;
cout<<"Input a number : "<<endl;
cin>>n;
if(n>0){
}else if(n<0){
}else{
return 0;
3.
#include <iostream>
int main(){
int n1,n2,n3;
cin>>n1>>n2>>n3;
cout<<n1<<n2<<n3;
cout<<n1<<n3<<n2;
cout<<n1<<n2<<n3;
cout<<n2<<n3<<n1;
cout<<n2<<n1<<n3;
}else if(n3>n1 && n3<n2){
cout<<n1<<n3<<n2;
cout<<n3<<n1<<n2;
cout<<n2<<n3<<n1;
}else{
cout<<n3<<n2<<n1;
return 0;
4. #include <iostream>
int main(){
int n;
cin>>n;
if(n%2==0){
}else{
system("pause");
system("cls");
return 0;
5. #include <iostream>
int main(){
int amount,yr;
float rate,total;
cin>>amount;
cin>>yr;
cin>>rate;
rate=rate/100;
total=amount;
for(int i=0;i<yr;i++){
total=total+(total*rate);
cout<<"At the end of the "<<yr<<" years "<<"you will have "<<total<<" dollars . "<<endl;
return 0;
3.