-
Notifications
You must be signed in to change notification settings - Fork 3
/
multiplicationTables.cpp
40 lines (30 loc) · 1007 Bytes
/
multiplicationTables.cpp
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
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;
int main() {
int number,choice,multiples;
bool playagain = true;
cout << "Welcome to the Multiplication Table Generator!\n";
do{
cout << "Enter a number : ";
cin >> number;
cout << "How many multiples do you want? ";
cin >> multiples;
cout << endl<<"Multiplication table of " << number << ":" << endl;
for (int i = 1; i <= multiples; ++i) {
cout << number << " x " << i << " = " << (number * i) << endl;
}
cout <<endl<< "Check another number's table? \n";
do{
cout << "Press 1 for yes, 2 for No\n";
cin >> choice;
if(choice!=2 && choice!=1){
cout << "Please enter valid response \n\n";
}
}while(choice!=2 && choice!=1);
if(choice==2){
playagain=false;
cout << "BYEE HAVE A GREAT TIME! ";
}
}while(playagain == true);
return 0;
}