Skip to content

Instantly share code, notes, and snippets.

@Yurlov
Created June 17, 2016 12:49
Show Gist options
  • Save Yurlov/21ea87f0cdb9c1f4cff70aeeec5083aa to your computer and use it in GitHub Desktop.
Save Yurlov/21ea87f0cdb9c1f4cff70aeeec5083aa to your computer and use it in GitHub Desktop.
Prog.kiev.ua
import java.util.Scanner;
public class RangePrint {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int first = in.nextInt();
int last = in.nextInt();
if(first<=last){
for (int i = first; i <= last; i++) {
System.out.print(i);
}
}else if (first>last){
for (int i = first;i>=last;i--){
System.out.print(i);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment