fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8. for (int i = 2; i <= n; i++) {
  9. if (i % 2 == 0) {
  10. cout << i << "^2 = " << i * i << endl;
  11. }
  12. }
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 16064KB
stdin
6
stdout
2^2 = 4
4^2 = 16
6^2 = 36