🔥Baekjoon start🔥

ariel·2021년 11월 2일
0

Baekjoon

목록 보기
3/14
post-thumbnail

2021-11-02

✍쪠와 함께 하루에 30분 이상 시작✨

💻 while문

10952

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	
	while(true){
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A==0 && B==0)
			break;
		System.out.println(A+B);
		}
	}
}

10951

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println(A+B);
		}
	}
}

1110

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	sc.close();
	
	int M = N;
	int i = 0;
	
	while(true){
		N = (N % 10*10)+((N/10+N%10)%10);
		i++;
		if(N==M) {
			break;
			}
		}
	System.out.println(i);
	}
}

0개의 댓글