Advertisement
Avdluna

URI 1071

Jul 12th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int x,y,s = 0,i;
  7.  
  8.     scanf("%d %d", &x, &y);
  9.  
  10.    if(x > y){
  11.  
  12.     for(i = y + 1 ; i < x ; i++){
  13.  
  14.         if( i%2 != 0){
  15.  
  16.           s +=  i  ;
  17.     }
  18.  
  19.     }
  20.  
  21.         printf("%d\n", s);
  22.    }
  23.  
  24.    if(x < y){
  25.  
  26.     for(i = x + 1; i < y ; i++){
  27.  
  28.         if(i%2 != 0){
  29.  
  30.              s += i ;
  31.  
  32.         }
  33.  
  34.     }
  35.  
  36.          printf("%d\n", s);
  37.  
  38.    }
  39.  
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement