Answers for "Uri/beecrowd problem no - 1099 solution in C"

C
0

Uri/beecrowd problem no - 1099 solution in C

#include<stdio.h>
int main(){
    int N,X,Y,i,j,sum = 0;
    scanf("%d", &N);
    
    for(i = 1; i <= N; i++){
        scanf("%d%d", &X, &Y);
        if(X > Y){
            for(j = Y+1,sum = 0; j < X; j++){
                if(j % 2 != 0){
                    sum += j;
                }
            }
        }else if(X <= Y){
            for(j = X+1,sum = 0; j < Y; j++){
                if(j % 2 != 0){
                    sum += j;
                }
            }
        }
        printf("%dn", sum);
    }
    return 0;
}
Posted by: Guest on January-04-2022

Code answers related to "Uri/beecrowd problem no - 1099 solution in C"

Code answers related to "C"

Browse Popular Code Answers by Language