0
#include <stdio.h>
int main (){
int x,y,i;
scanf("%d",&x);
scanf("%d",&y);
if ((x<y)&&(x>1)&&(x<20)&&(y<10000)){
for (i=1;i<=x;i++){
printf("%d ",i);
}
printf("\n");
for (i=(x+1);i<=y;i++){
printf("%d ",i);
}
}
return 0;
}
objective of the programme:
1st: The program reads two numbers X and Y (X minor Y). Next shows a sequence from 1 to Y, passing to the next line to each X numbers.
2º: Each sequence shall be printed on one line, with a blank space between each number.
3º: The entry contains two integers X (greater than 1 and less than 20) and Y (greater than X and less than 100000) respectively.
4º:OBS: The program does not need to have an answer for cases where the program does not run, and also does not need user interaction.
***Example demonstrating my program error:
By removing that last space before the break of each line the problem of the question will be solved, I just can’t find a way to do it.
I adjusted the code this way and got, but there is a problem, the first line is correct, but for larger values ex:(x=10,y=50) the code is not skipping lines. How can I adjust it to be generic ? - Because if I put x=10,y=20 the code gets right, but as stated earlier for higher values of y the display gets wrong.
– Erick