Last active
December 6, 2022 13:41
-
-
Save NonymousMorlock/cc0bd170c92990a887949ffd6e85bd2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int question1() | |
{ | |
double amount = 100000; | |
double interest = 0.08; | |
double total = 0; | |
for (int year = 1; year <= 5; year++) | |
{ | |
total = amount * (1 + interest); | |
amount = total; | |
} | |
cout << total << endl; | |
return 0; | |
} | |
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int question2() | |
{ | |
double amount = 1000000; | |
double interest = 0.06; | |
long total = 0; | |
for (int year = 1; year <= 4; year++) | |
{ | |
total = amount * (1 + interest); | |
amount = total; | |
} | |
cout << total << endl; | |
return 0; | |
} | |
int question3() | |
{ | |
double block = 8000; | |
double cement = 750000; | |
double sand = 9000; | |
double delivery = 600000; | |
long total = block + cement + sand + delivery; | |
double paid = 1100; | |
long balance = total - paid; | |
cout << "Total amount spent on the project: " << total << endl; | |
cout << "Balance received: " << balance << endl; | |
return 0; | |
} | |
int question4() | |
{ | |
double amount = 1250; | |
double interest = 0.10; | |
long total = 0; | |
for (int year = 1; year <= 3; year++) | |
{ | |
total = amount * (1 + interest); | |
amount = total; | |
} | |
cout << total << endl; | |
return 0; | |
} | |
int question5() | |
{ | |
int m, n; | |
cout << "Enter the number of vectors: "; | |
cin >> m; | |
cout << "Enter the size of the vectors: "; | |
cin >> n; | |
int x[m][n]; | |
int y[m][n]; | |
for (int i = 0; i < m; i++) | |
{ | |
for (int j = 0; j < n; j++) | |
{ | |
cout << "Enter the value of x[" << i << "][" << j << "]: "; | |
cin >> x[i][j]; | |
} | |
} | |
for (int i = 0; i < m; i++) | |
{ | |
for (int j = 0; j < n; j++) | |
{ | |
cout << "Enter the value of y[" << i << "][" << j << "]: "; | |
cin >> y[i][j]; | |
} | |
} | |
for (int i = 0; i < m; i++) | |
{ | |
for (int j = 0; j < n; j++) | |
{ | |
if (x[i][j] < y[i][j]) | |
{ | |
cout << "x[" << i << "][" << j << "] is less than y[" << i << "][" << j << "]" << endl; | |
} | |
else | |
{ | |
cout << "y[" << i << "][" << j << "] is less than x[" << i << "][" << j << "]" << endl; | |
} | |
} | |
} | |
for (int i = 0; i < m; i++) | |
{ | |
for (int j = 0; j < n; j++) | |
{ | |
if (x[i][j] < y[i][j]) | |
{ | |
cout << "The minimum value of x[" << i << "][" << j << "] is: " << x[i][j] << endl; | |
} | |
else | |
{ | |
cout << "The minimum value of y[" << i << "][" << j << "] is: " << y[i][j] << endl; | |
} | |
} | |
} | |
return 0; | |
} | |
int main() | |
{ | |
question1(); | |
question2(); | |
question3(); | |
question4(); | |
question5(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment