Math, asked by psinha8152, 1 year ago

Natural numbers between a range of two numbers separated by a single space.


Anonymous: ___k off

Answers

Answered by Anonymous
0

public static void printRange( int x, int y) {

if(y > x) {

for (int j = x; j <= y; j++) {

int i = 1*j + (x - 1);

System.out.print(j + " ");

}

}

else if (x > y){

for (int j = x; j>= y; j--) {

int i = -1*y + (x -y +1) * 2 +1;

System.out.print(j + " ");

}

}

else {

System.out.print(x);

}

}

Answered by Aikantika
0

THE ANSWER IS 1.i think I am right.

Similar questions