전체 글
-
[JAVA] CodingTest 문제 3번 - ex2카테고리 없음 2022. 11. 8. 17:50
package day1031.CodingTest; import java.util.Scanner; public class main03_1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = "apple"; char[] ss = new char[s.length()]; System.out.println("알파벳 입력"); String in = sc.next(); char input = in.charAt(0); boolean b = false; for (int i = 0; i
-
[JAVA] CodingTest 문제 3번 - ex1카테고리 없음 2022. 11. 8. 17:49
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class appleIndex { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("영어 단어를 입력해주세요."); String findword = sc.next(); // 찾고싶은 단어 만들기 System.out.println("찾고싶은 단어를 입력해주세요."); String input = sc.next(); if (findword.indexOf(input) == -1) { System.out.println("-1"); } else..
-
[JAVA] CodingTest 문제 2번 - ex2카테고리 없음 2022. 11. 8. 17:48
import java.util.Scanner; public class Test2 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int[] count = new int[10]; System.out.println("첫번째 숫자를 입력해주세요."); int number1 = sc.nextInt(); System.out.println("두번째 숫자를 입력해주세요."); int number2 = sc.nextInt(); System.out.println("세번째 숫자를 입력해주세요."); int number3 = sc.nextInt(); System.out.println("첫번째 숫자 :"+number1+..
-
[JAVA] CodingTest 문제 2번 - ex1카테고리 없음 2022. 11. 8. 17:45
[JAVA] CodingTest 문제 2번 - ex1 import java.util.ArrayList; public class main02_1 { public static void main(String[] args) { int a = 123; int b = 234; int c = 125; int quotient = a * b * c; // 몫. 세 수의 곱. System.out.println("찾을 숫자 : "+quotient); int group[] = new int[10]; // 0~9의 배열.(인덱스 번호에 해당하는 숫자 갯수를 카운트 해 줄거여서.) int reminder = 0; // 나머지. /* while(quotient > 0) { reminder = quotient%10; quotient..
-
[JAVA] CodingTest 문제 1번 - ex1카테고리 없음 2022. 11. 8. 17:25
CodingTest 문제 1번 - ex1 public class studentScore { public static void main(String[] args) { int[][] student = { { 1, 2, 5, 10, 20 }, { 1, 41, 50, 60, 70 }, { 35, 45, 55, 60, 70 }, { 1, 20, 30, 49, 57 } }; int total = 0; int count = 0; int a = 0; for (int i = 0; i
-
[JAVA] CodingTest 문제 목록카테고리 없음 2022. 11. 8. 17:23
1.각 클래스의 학생들의 점수가 2차원 배열로 주어진다. 주어진 점수의 평균을 내고, 그 평균보다 높은 점수를 출력하라. 예를 들어 [[88,74,78,90,54],[78,43,30,90,54],[74,38,92,98,33]] 에서 모든 학생의 평균을 내고, 평균보다 높은 점수를 출력하라. 2.세개의 자연수가 주어지면 그 세 숫자를 곱해서 나온 숫자를 구성하는 각 숫자의 갯수를 세고, 각 숫자가 몇번 나왔는지 출력하라. 예를 등러 123 x 212 x 125 = 3259500이다. 0은 2개, 1은 0개, 2는 1개 ..... 9는 0개를 출력해라. 3.단어가 주어진다. 그리고 알파벳 하나를 입력하여 주어진 단어의 몇번째 index에 해당 알파벳이 있는지 출력하라. 예를 들어, apple이 주어지고 입력..