Advertisement
Spocoman

Multiply Table

Sep 21st, 2023
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int num;
  7.     cin >> num;
  8.  
  9.     for (int i = 1; i <= (num % 10); i++) {
  10.         for (int j = 1; j <= ((num / 10) % 10); j++) {
  11.             for (int k = 1; k <= (num / 100); k++) {
  12.                 cout << i << " * " << j << " * " << k << " = " << i * j * k << ";\n";
  13.             }
  14.         }
  15.     }
  16.  
  17.     return 0;
  18. }
  19.  
  20. Или:
  21.  
  22. #include <iostream>
  23.  
  24. using namespace std;
  25.  
  26. int main() {
  27.     string num;
  28.     cin >> num;
  29.  
  30.     for (int i = 1; i < num[0] - 47; i++) {
  31.         for (int j = 1; j < num[1] - 47; j++) {
  32.             for (int k = 1; k < num[2] - 47; k++) {
  33.                 cout << i << " * " << j << " * " << k << " = " << i * j * k << ";\n";
  34.             }
  35.         }
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement