Advertisement
gasaichan

Lab215

Sep 30th, 2017
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <locale>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. void main() {
  9.     setlocale(LC_ALL, "Russian");
  10.  
  11.     int input = 1;
  12.     while (true) {
  13.         cout << "Введите число (0 - окончание программы): ";
  14.         cin >> input;
  15.         while (input < 0 || input > 20) {
  16.             cout << "Введите число от 1 до 20: ";
  17.             cin >> input;
  18.         }
  19.         if (input == 0) { break; }
  20.         cout << "Число " << setw(10) << "Квадрат" << endl;
  21.         for (int i = 1; i <= input; i++) {
  22.             cout << i << setw(10) << i * i << endl;
  23.         }
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement