fork download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. { int max = 30, evenNum;
  8. /* Odd or even? */
  9. if((max % 2)==1)
  10. evenNum = 0;
  11. else
  12. evenNum = 1;
  13. if(evenNum==1)
  14. {
  15. for(int x=1; x<=max; x++)
  16. {
  17. {
  18. cout << x << " " << (max/2)+x << endl;
  19. if (x >= (max/2))
  20. break;
  21. }
  22. }
  23. }
  24. else
  25. for(int x=1; x<=(max+1); x++)
  26. {
  27. {
  28. if(x == ((max+1)/2))
  29. cout << x << endl;
  30. else
  31. cout << x << " " << ((max+1)/2)+x << endl;
  32. if (x >= ((max+1)/2))
  33. break;
  34. }
  35. }
  36.  
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
1 16
2 17
3 18
4 19
5 20
6 21
7 22
8 23
9 24
10 25
11 26
12 27
13 28
14 29
15 30