JAVA245 [알고리즘 기초 100제] 대소문자 변환 문제 대문자는 소문자로 소문자는 대문자로 변환하시오 Ex) HelloWorld hELLOwORLD package_5_CapToLow; public class Main{ public static void main(String[] args){ String input ="HelloWorld"; char[]arr; System.out.print(arr); Systme.out.println(); for (int i=0; i = 'a' && arr[i] ,='z'){ arr[i] = (char)(arr[i] + 'A' - 'a'); //아스키코드 값의 대문자 A값에서 소문자 a 값을 뺀후 그것을 소문자 배열에 //더함(소문자를 대문자로 바꾸기) } else.. 2021. 3. 29. 10진수를 2진수로 변환 package_4_DectoBin; public class Main{ public static void main(String[] args){ int inputNum = 19; int bin[] = new int[100]; int i = 0; int mok = inputNum; while(mok > 0){ bin[i] = mok % 2; mok /= 2; i++; } i--; for(; i>=0; i--){ System.out.print(bin[i]); } } } 2021. 3. 25. 최빈수 구하기 가장 많이 출현한 수를 구하시오 EX) 1 1 1 1 2 1 3 4 2 1 1 정답 : 1 (7회) package_3_mode; import java.util.Scanner; public classs Main { public static void main(string[] args){ Scanner scan = new Scanner(System.in); int []inputNum = new int[10]; for(int i=-; i 2021. 3. 25. 피보나치 수열 Package _2; public class Main{ public static void main(string[] args){ int []arr = new int[100]; //An = An-1 + An-2; n>3 //a1 =1 a=2 = 1 arr[1] = 1; arr[2] = 1; for(int i =3; i 2021. 3. 23. 이전 1 ··· 58 59 60 61 62 다음