Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int tc,i,x,y,sum=0;
  5. scanf("%d",&tc);
  6.  
  7. for(i=0;i<tc;i++){
  8. scanf("%d%d",&x,&y);
  9. if(x<y){
  10. for(x=x+1;x<y;x++){
  11. if(x%2!=0){
  12. sum=sum+x;
  13. }
  14. }
  15. }
  16. else if(x>y){
  17. for(y=y+1;y<x;y++){
  18. if(y%2!=0){
  19. sum=sum+y;
  20. }
  21. }
  22. }
  23. printf("%d\n",sum);
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement