#include<stdio.h>
int main()
{
int i, x, y, sum = 0, a;
scanf("%d %d", &x, &y);
if(x>y)
{
if(y % 2 == 0)
{
a = y;
}
else
{
a = y+1;
}
for(i=a; i<x; i++)
{
if(i%2 != 0)
{
sum = sum + i;
}
}
}
if(x<y)
{
if(y % 2 == 0)
{
a = x;
}
else
{
a = x+1;
}
for(i=a; i<y; i++)
{
if(i%2 != 0)
{
sum = sum +i;
}
}
}
printf("%d\n",sum);
return 0;
}
int main()
{
int i, x, y, sum = 0, a;
scanf("%d %d", &x, &y);
if(x>y)
{
if(y % 2 == 0)
{
a = y;
}
else
{
a = y+1;
}
for(i=a; i<x; i++)
{
if(i%2 != 0)
{
sum = sum + i;
}
}
}
if(x<y)
{
if(y % 2 == 0)
{
a = x;
}
else
{
a = x+1;
}
for(i=a; i<y; i++)
{
if(i%2 != 0)
{
sum = sum +i;
}
}
}
printf("%d\n",sum);
return 0;
}
Comments
Post a Comment