Advertisement
Rehan_Rahman26

uri 1099

May 27th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int n,a,b,t,i,sum=0;
  5.     scanf("%d",&n);
  6.     for(i=1; i<=n; i++){
  7.         scanf("%d %d",&a,&b);
  8.         if(a<b){t=a;a=b;b=t;}
  9.         for(i=b+1; i<a; i++){
  10.             if(i%2!=0) sum+=i;
  11.             if(a==b) sum+=0;
  12.         }
  13.         printf("%d\n",sum);
  14.     }
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement