2014年6月24日 星期二

uva 10783 Odd Sum


#include <stdio.h>
#include <stdlib.h>

int main(void){
    int amount, low, high;
    int sum,i;

    scanf("%d",&amount);
    i=1;
    while(i<=amount){
        scanf("%d",&low); scanf("%d",&high);

        for(sum=0;low<=high;low++){
            if(low%2!=0){
                sum+=low;
            }
        }
        printf("Case %d: %d\n",i,sum);
        ++i;
    }


    return 0;
}

沒有留言:

張貼留言