Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- int begin, end;
- int sum = 0;
- cout << "Введите начало диапазона: ";
- cin >> begin;
- cout << "Введите конец диапазона: ";
- cin >> end;
- end++;
- int num = begin;
- while (num != end) {
- if (num % 2 == 1) {
- sum += num;
- }
- num++;
- }
- cout << sum << endl;
- }
Add Comment
Please, Sign In to add comment