알고리즘

While로 sum구하기 실습 1-4 public class SumWhile { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); System.out.println("1부터 n까지의 합을 구합니다"); System.out.print("n의 값 : "); int n = stdIn.nextInt(); int sum = 0; int i = 1; while (i while문이 종료될 때 == 조건이 성립하지 않을 때 == i > n 일 때 i값 출력 For로 sum구하기 실습 1-5 public class SumFor { public static void main(String[] args) { Scanner stdIn..
알고리즘이란? 문제를 해결하기 위한 것으로, 명확하게 정의되고 순서가 있는 유한 개의 규칙으로 이루어진 집합 세 값의 최댓값 구해보기 package com.in28minutes.algorithm; import java.util.Scanner; public class Max3 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); System.out.println("세 정수의 최대 값을 구합니다"); System.out.print("a의 값 : "); int a = stdIn.nextInt(); System.out.print("b의 값 : "); int b = stdIn.nextInt(); System.out.pr..
dev_rosieposie
'알고리즘' 태그의 글 목록