Advertisement
anhkiet2507

Bài 4 Tin

Apr 5th, 2019
34,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. //Bài 4: In bảng nhân
  2. #include <stdio.h>
  3. #include <string>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main() {
  8.     string s;
  9.     for (int j = 0; j < 10; j++) {
  10.         for (int i = 1; i <= 5; i++) {
  11.             s = to_string(i) + " x " + to_string(j) + " = " + to_string(i*j);
  12.             printf("%20s", s.c_str());
  13.         }
  14.         printf("\n");
  15.     }
  16.     printf("\n");
  17.     for (int j = 0; j < 10; j++) {
  18.         for (int i = 6; i <= 10; i++) {
  19.             s = to_string(i) + " x " + to_string(j) + " = " + to_string(i*j);
  20.             printf("%20s", s.c_str());
  21.         }
  22.         printf("\n");
  23.     }
  24.     system("pause");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement