Daffodil International University
Problem Link
//Please follow from main function
#include<stdio.h>
int main(){
int i, j, k=0, n, sum=0, x, y;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d %d", &x, &y);
for(j=x; ; j++){
if(j%2!=0){
k++;
sum+=j;
}
if(k==y){
break;
}
}
printf("%d\n", sum);
sum=0, k=0;
}
return 0;
}
0 Comments