반응형
https://www.hackerrank.com/challenges/30-loops/problem?h_r=next-challenge&h_v=zen
Day 5: Loops | HackerRank
Let's talk about loops.
www.hackerrank.com
원하는 구구단 수를 입력하면 10까지 곱한 값을 프린트하기
성공코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
public class Solution {
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int n = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
scanner.close();
for (int i = 1; i < 11; i++) {
System.out.println(n + " x " + i + " = " + n*i);
}
}
}
|
cs |
반응형