Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int T, high, low, i, sum;
- cin >> T;
- for(i = 1; i <= T; i++){
- cin >> low >> high;
- sum = 0;
- (low % 2) ? low : low++;
- while(low <= high) {
- sum += low;
- low += 2;
- }
- cout << "Case " << i << ": " << sum << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement