Eggs Sunny Side Up
본문 바로가기

분류 전체보기399

[Java Festival] 2차원 배열을 왼쪽으로 90도 회전하여 출력 public class P_23번 { public static void main(String[] args) { int[][] array = new int[5][5]; int cnt = 1; for(int i = 0; i < array.length; i++) { for(int j = 0; j < array[i].length; j++) { array[i][j] = cnt++; } } for(int i = 0; i < array.length; i ++) { for(int j = 0; j < array[i].length; j++) { System.out.print(array[j][4-i]+" "); } System.out.println(); } //0.0 0.1 0.2 0.3 0.4 //4.0 3.0 2.0 1.. 2023. 3. 13.
[Java Festival] 8자리 정수를 입력받아 정수의 합을 출력 import java.util.Random; import java.util.Scanner; public class d { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("정수 입력 : "); int num = sc.nextInt(); int result = num; int sum = 0; while(result > 0) { sum = sum + (result%10); result = (result/10); } System.out.println("합은 "+sum+"입니다."); } } 2023. 3. 13.
[Java Festival] 알파벳의 빈도를 대소문자 구별없이 카운트하기 import java.util.Scanner; public class d { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] count = new int[26]; System.out.print("입력 >> "); String target = sc.nextLine(); target = target.toLowerCase(); target = target.replace(" ", ""); for(int i = 0; i < 26; i++) { count[i] = 0; } for(int i = 0; i < target.length(); i++) { count[target.charAt(i)-97]++; } for(i.. 2023. 3. 13.
[Java Festival] N과 X의 정수를 입력받고 X보다 작은 수만 출력 import java.util.Scanner; public class d { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("N 입력 >> "); int n = sc.nextInt(); System.out.print("X 입력 >> "); int x = sc.nextInt(); String result = ""; for(int i = 0; i > "); int num = sc.nextInt(); if(num < x) { result += num+" "; } } System.out.println("결과.. 2023. 3. 13.
[Java Festival] 문자열 형태의 2진수를 10진수로 변환 public class You_28번 { public static void main(String[] args) { //문자열 형태의 2진수를 입력받아 //10진수로 바꾸는 프로그램을 작성하시오. String str = "01001101"; int result = Integer.parseInt(str, 2); System.out.print(str+"(2) = "+result+"(10)"); } } 2진수 --> 10진수 Integer.parseInt(변수, 2) 2023. 3. 11.
[ORACLE] NULL 처리하기 문제 설명 ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디, 생물 종, 보호 시작일, 보호 시작 시 상태, 이름, 성별 및 중성화 여부를 나타냅니다. NAMETYPENULLABLE ANIMAL_ID VARCHAR(N) FALSE ANIMAL_TYPE VARCHAR(N) FALSE DATETIME DATETIME FALSE INTAKE_CONDITION VARCHAR(N) FALSE NAME VARCHAR(N) TRUE SEX_UPON_INTAKE VARCHAR(N) F.. 2023. 3. 11.