add closing the scanner

This commit is contained in:
JeonSeongBae 2017-12-19 19:32:50 +09:00
parent 153b9fe1cb
commit 1e38751a6b

View File

@ -6,7 +6,7 @@ class FloydTriangle {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows which you want in your Floyd Triangle: ");
int r = sc.nextInt(), n = 0;
sc.close();
for(int i=0; i < r; i++) {
for(int j=0; j <= i; j++) {
System.out.print(++n + " ");