Untitled
#include <stdio.h> int main() { int A, B, odd; int t; scanf("%d", &t); for (int j = 1; j <= t; j++) { scanf("%d %d", &A, &B); if (A < B && B-A!=1) { int sum = 0; for (int i = A; i < B;i++ ) { odd = i % 2; if (odd != 0) { sum = sum + i; } } printf("%d\n", sum); } else if (B < A && A-B!=1) { int sum = 0; for (int i = B; i < A; ) { i++; odd = i % 2; if (odd != 0) { sum = sum + i; } } printf("%d\n", sum); } else if (A-B==1 || B-A==1) { printf("0\n"); } } }