Skip to content

Commit cde779b

Browse files
Add files via upload
1 parent 48409e7 commit cde779b

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int main()
7+
{
8+
const int NO_OF_YEARS = 10;
9+
int r, D;
10+
vector <int> X(NO_OF_YEARS);
11+
cin >> r >> D >> X[0];
12+
13+
for(int i = 1; i <= NO_OF_YEARS; i++)
14+
{
15+
X[i] = r*X[i - 1] - D;
16+
}
17+
18+
for(int i = 1; i <= NO_OF_YEARS; i++)
19+
{
20+
cout << X[i] << "\n";
21+
}
22+
return 0;
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int main()
7+
{
8+
int age, cost;
9+
cin >> age >> cost;
10+
11+
if(age <= 5)
12+
{
13+
cost = 0;
14+
}
15+
else if(age <= 12)
16+
{
17+
cost /= 2;
18+
}
19+
20+
cout << cost << "\n";
21+
return 0;
22+
}

0 commit comments

Comments
 (0)