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