-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path02.cpp
More file actions
32 lines (28 loc) · 635 Bytes
/
Copy path02.cpp
File metadata and controls
32 lines (28 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
using namespace std;
/**
* Create a function that prints a multiplication table with a given base number
* It should take the base number as a parameter, and print the output to the cout
*
* The output should look like this for 5 as base:
* 1 * 5 = 5
* 2 * 5 = 10
* 3 * 5 = 15
* 4 * 5 = 20
* 5 * 5 = 25
* 6 * 5 = 30
* 7 * 5 = 35
* 8 * 5 = 40
* 9 * 5 = 45
* 10 * 5 = 50
*/
void multiply_table(int base) {
for (int i = 1; i <= 10; i++) {
cout << i << " * " << base << " = " << i * base << endl;
}
}
int main() {
int number = 5;
multiply_table(number);
return 0;
}