1523. 在区间范围内统计奇数数目
题目链接:1523. 在区间范围内统计奇数数目
代码如下:
cpp
class Solution {
public:
int countOdds(int low, int high) {
int res = 0;
for (int i = low;i <= high;i++) {
if (i % 2 != 0) {
res++;
}
}
return res;
}
};