Aici avem 7^2 = 49 = 4+5+6+7+8+9+10. Se intelege din enunt ca 72 = 4+5+6+7+8+9+10 ceea ce n-at fi corect. Este vorba de problema numere_norocoase. Succes!
int norocoase(int a, int b)
{
if(a % 2 == 1 || b % 2 == 1) return ((b - a) / 2) + 1;
if(a % 2 == 0 && b % 2 == 0) return (b - a) / 2;
}