알고리즘풀이153 [정올/JAVA] 175 : 함수2 - 형성평가1 정수 N을 입력받고 다시 N개의 정수를 입력받아 내림차순으로 정렬하여 출력하는 프로그램을 작성하시오. 공부하시는대에 도움이 됐으면 좋겠습니다. 답안코드 확인해주세요! 더보기 import java.util.Scanner; public class Main { public static int[] sort(int[] arr) { int temp; for (int i = 0; i < arr.length - 1; i++) { for (int j = i + 1; j < arr.length; j++) { if (arr[i] < arr[j]) { temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } return arr; } public static void main(String args[]) { Scanner in = new Scanner(System.in); int many =.. 2020. 7. 28. [정올/JAVA] 586 : 함수2 - 자가진단8 공부하시는대에 도움이 됐으면 좋겠습니다. 답안코드 확인해주세요! 더보기 import java.util.Scanner; public class Main { public static void macro(int input1, int input2) { int result1, result2; result1 = (input1 - input2) * (input1 - input2); result2 = (input1 + input2) * (input1 + input2) * (input1 + input2); System.out.println("("+input1 +" - " + input2 +") ^ 2 = " + result1); System.out.println("("+input1 +" + " + input2 +") ^.. 2020. 7. 28. [정올/JAVA] 585 : 함수2 - 자가진단7 import java.util.Scanner; public class Main {public static void bubble(int[] arr) {int temp;for (int i = 0; i < arr.length - 1; i++) {for (int j = 0; j < arr.length -1; j++) {if (arr[j] < arr[j + 1]) {temp = arr[j];arr[j] = arr[j + 1];arr[j + 1] = temp;}} for (int num = 0; num < arr.length; num++) {System.out.print(arr[num] + " ");}System.out.println();} } public static void main(String args[]) .. 2020. 7. 25. [정올/JAVA] 584 : 함수2 - 자가진단6 main() 함수 내에는 숫자를 사용하지 말고 1, 2, 3 세 개의 숫자를 조합하여 가능한 한 모든 합을 출력하는 프로그램을 작성하시오. 출력예와 같이 출력하시오. 공부하시는대에 도움이 됐으면 좋겠습니다. 답안코드 확인해주세요! 더보기 public class Main { public static void call() { for (int i = 1; i 2020. 7. 25. 이전 1 ··· 21 22 23 24 25 26 27 ··· 39 다음