fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int i; int start = 1;
  6. int oddNumCnt[21]; //an array filled with odd numbers, for later usage in the 3rd street's calculations
  7.  
  8. for (i = 20; i >= 1; i--){ //filling oddNumCnt
  9. if (i % 2 != 0){
  10. oddNumCnt[start] = i;
  11. start++;
  12. }
  13. }
  14.  
  15. start = 11;
  16. for (i = 1; i <= 20; i++){
  17. if (i % 2 != 0){
  18. oddNumCnt[start] = -i;
  19. start++;
  20. }
  21. }
  22.  
  23. for (i = 1; i < 21; i++){
  24. cout <<oddNumCnt[i] << endl;
  25. }
  26.  
  27. cout << 1 - -1;
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5524KB
stdin
Standard input is empty
stdout
19
17
15
13
11
9
7
5
3
1
-1
-3
-5
-7
-9
-11
-13
-15
-17
-19
2