#include<stdio.h>
int main()
{
int a,b,i,t,n,sum;
while(scanf("%d",&t)!=EOF)
{
for(i=1;i<=t;i++)
{
sum=0;
scanf("%d%d",&a,&b);
for(n=a;n<=b;n++)
{
if(n%2!=0)
sum=sum+n;
}
printf("case:%d %d\n",i,sum);
}
}
return 0;
}
int main()
{
int a,b,i,t,n,sum;
while(scanf("%d",&t)!=EOF)
{
for(i=1;i<=t;i++)
{
sum=0;
scanf("%d%d",&a,&b);
for(n=a;n<=b;n++)
{
if(n%2!=0)
sum=sum+n;
}
printf("case:%d %d\n",i,sum);
}
}
return 0;
}
0 comments:
Post a Comment