- 计算1—100中奇数的和、偶数的和
uggfggh
- 2023-9-10 14:08:43 @
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n=0,a=0;
for(int i=1;i<=100;i++)
{
if(i%2!=0)
{
n+=i;
}
if(i%2==0)
{
a+=i;
}
}
cout<<n<<" "<<a;
return 0;
}
0 comments
No comments so far...
Information
- ID
- 784
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 122
- Accepted
- 33
- Uploaded By