Advertisement
eg0rmaffin

Все квадраты натуральных чисел до числа N

Jun 27th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int
  4. main ()
  5. {
  6.   int a, n;
  7.   cout << "Please input n: ";
  8.   cin >> n;
  9.   a = 0;
  10.   while ((a * a) <= n)
  11.     { a = a + 1;
  12.       if ((a * a) > n)
  13.     {
  14.       break;
  15.     }
  16.       cout << a * a << " ";
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement