Beecrowd 1099 – Sum of Consecutive Odd Numbers II solution in C, Python
Beecrowd 1099 – Sum of Consecutive Odd Numbers II solution in C Question Link Solution in C #include <stdio.h> int main() { int n,x,y,i,j,sum=0,temp=0; scanf(“%d”,&n); for(i=0;i<n;i++){ scanf(“%d %d”,&x,&y); if(x>y){ temp=x; x=y; y=temp; } if(x%2==0){ x–; } x+=2; for(j=x;j<y;j+=2){ sum=sum+j; } printf(“%d\n”,sum); sum=0; } return 0; } Beecrowd 1099 – Sum of Consecutive Odd Numbers II … Read more