Pages

Monday, August 8, 2011

d491. 我也愛偶數 (swap 版)


#include
using namespace std;
#include


int main()
{
int a,b;
while(cin>>a>>b)
{
if(a>b)
{
int temp=a;
a=b;
b=temp;
}
int sum=0;
for(int i=a;i<=b;i++)
{
if(i%2==0) //別種寫法?
sum += i;
}
cout< }

return 0;
}

No comments:

Post a Comment