Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t,m,a,b,sum=0,i;
- scanf("%d",&t);
- for(m=1; m<=t; m++)
- {
- scanf("%d %d",&a,&b);
- if(a>b)
- {
- for(i=(b+1); i<a; i++)
- {
- if(i%2!=0)
- {
- sum=sum+i;
- }
- }
- }
- else if(b>a)
- {
- for(i=(a+1); i<b; i++)
- {
- if(i%2!=0)
- {
- sum=sum+i;
- }
- }
- }
- printf("%d\n",sum);
- sum=0;
- a=0;
- b=0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement