fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int m,n,i,sum;
  5. scanf("%d %d",&m,&n);
  6. if(m>n){
  7. m=n+m;
  8. n=m-n;
  9. m=m-n;
  10. }
  11. for(i=m;i<=n;i++){
  12. if(i%2!=0)
  13. sum+=i;
  14. }
  15. printf("%d",sum);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5284KB
stdin
15 7
stdout
55