Beecrowd-1070 Six Odd Numbers Solution

Beecrowd-1070

Beecrowd-1070 Six Odd Numbers Solution Beecrowd 1070 Six Odd Number Read an integer value X and print the 6 consecutive odd numbers from X, a value per line, including X if it is the case. Input The input will be a positive integer value. Output The output will be a sequence of six odd numbers. Input Sample Output Sample 8 … Read more

Beecrowd 1099 – Sum of Consecutive Odd Numbers II solution in C, Python

Beecrowd 1099

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