2032 奇数求和

#include<bits/stdc++.h>
#define f(i,s,e) for(int i = s; i <= e; i++)
#define ll long long
using namespace std;
const int N = 1e3+10,inf = 0x3f3f3f3f;

int main()
{
    int m,n,sum = 0;
    cin >> m >> n;
    for(int i = m; i <= n; i++)
    {
        if(i % 2 == 1) //i为奇数 
        {
            sum += i; //累加i 
        }
    }
    cout << sum;
    return 0;
}

 

posted @ 2024-06-28 18:00  CRt0729  阅读(10)  评论(0编辑  收藏  举报