로딩
요청 처리 중입니다...

문자열 반복해서 출력하기

 문자열 반복해서 출력하기

import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int n = sc.nextInt(); for(int i = n; n > 0 ; n--) System.out.print(str); } } 이번 문제는 새로 알게된 사실이 있다. 여태까지 자바에 System.out.

출력문에 printf라는 출력문이 있는지 몰랐다. 따라서 자바 출력문을 찾아서 공부해보았다.

메소드 서식 특징 System.out.print(변수); 줄바꿈 문자를 포함하지 않고 변수를 그대로 표현. System.out.printf("서식", 변수 ); %d, %f, %c, %s, %o(8진 정수) %x(16진 정수), %%(퍼센트 표시) 등...

System.out.println(변수); 줄바꿈 문자를 ...

# 문자열반복해서출력하기 # 자바 # 프로그래머스