Advertisement
MonsterScripter

CodinGame_2023_09_05__18_14_01__odd.cpp

Sep 5th, 2023
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n;
  11.     cin >> n; cin.ignore();
  12.     // Boucle pour afficher les nombres impairs de 1 à n
  13.     for (int i = 1; i <= n; i += 2) {
  14.         cout << i << endl;
  15.     }
  16.     return 0;
  17. }
  18.  
  19. /*
  20. 01 Test 1
  21. Entrée
  22. Sortie attendue
  23. 9
  24. 1
  25. 3
  26. 5
  27. 7
  28. 9
  29.  
  30. 02 Test 2
  31. Entrée
  32. Sortie attendue
  33. 101
  34. 1
  35. 3
  36. 5
  37. 7
  38. 9
  39. 11
  40. 13
  41. 15
  42. 17
  43. 19
  44. 21
  45. 23
  46. 25
  47. 27
  48. 29
  49. 31
  50. 33
  51. 35
  52. 37
  53. 39
  54. 41
  55. 43
  56. 45
  57. 47
  58. 49
  59. 51
  60. 53
  61. 55
  62. 57
  63. 59
  64. 61
  65. 63
  66. 65
  67. 67
  68. 69
  69. 71
  70. 73
  71. 75
  72. 77
  73. 79
  74. 81
  75. 83
  76. 85
  77. 87
  78. 89
  79. 91
  80. 93
  81. 95
  82. 97
  83. 99
  84. 101
  85.  
  86. 03 Test 3
  87. Entrée
  88. Sortie attendue
  89. 20
  90. 1
  91. 3
  92. 5
  93. 7
  94. 9
  95. 11
  96. 13
  97. 15
  98. 17
  99. 19
  100.  
  101. 04 Test 4
  102. Entrée
  103. Sortie attendue
  104. 2
  105. 1
  106. */
  107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement