Задание 4 Урок 11
Primary tabs
Решите с помощью цикла while:
Выведите на экран, все четные числа от 35 до 117 и нечетные числа, лежащие в диапазоне от 45 до 99.
var i: integer; begin i := 35; while ((i >= 35) and (i <= 117)) do begin if ((i <= 117) and (i mod 2 = 0)) then write(i, ' '); if ((i >= 45) and (i <= 99) and (i mod 2 = 1)) then write(i, ' '); i := i + 1; end; readln(); end.
Консоль:
36 38 40 42 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 104 106 108 110 112 114 116
- Log in to post comments
- 363 reads