Advertisement
Riposati

problema 1071 URI

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