일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- JEUS6.0
- jQuery
- bluestack
- IT
- 붕괴3
- Windows 10
- 세븐나이츠
- Sculpt Erogonomic Desktop
- 간접표현식
- ubuntu
- VBA
- 세나
- Clash Royale
- 윈도우 10
- HTML
- 다윈스트리밍서버
- 간접 표현식
- WebtoB
- 다윈 스트리밍 서버
- 처비
- Http Live Streaming Server
- 클래시 로얄
- WiFi
- JEUS
- 하스스톤
- 윈도우10
- 모바일게임
- gson
- IT 인코딩 encoding
- 초대장
- Today
- Total
목록웹 개발/Java (41)
공책
public class Work1 {public static void main(String[] args) {//arr 이란 이름의 배열 안에// 10, 20, 30, 40, 50 을 넣어 초기화 한 후//배열 arr에 담긴 모든 값을 더하는 프로그램을 완성int arr[] = {10, 20, 30, 40, 50};int res =0;for(int i : arr){res += i;}System.out.println(res);}}
public class Ex4_work {public static void main(String[] args) {//Scanner를 통해 사용자가 현재 가지고 있는 돈을 입력받고//크림빵, 새우깡, 콜라를 잔돈을 남기지 않고 구입할 수 있는 경우의 수를 //모두 출력하기//크림빵 500, 새우깡 700, 콜라 400//결과 : //당신이 소유한 금액 : 4000//크림빵 1개, 새우깡 1봉지, 콜라 7캔//크림빵 2개, 새우깡 2봉지, 콜라 4캔//크림빵 3개, 새우깡 3봉지, 콜라 1캔//크림빵 5개, 새우깡 1봉지, 콜라 2캔final int cream = 500;final int shrimp = 700;final int coke = 400;int money = 0;Scanner sc = new Sc..
int i = 1;int n1 = 0;int n2 = 0;Scanner sc = new Scanner(System.in);n1 = sc.nextInt();n2 = sc.nextInt();while(!(i % n1 == 0 && i % n2 ==0)){i++;}System.out.println("최소 공배수는 "+ i);
04, 05, 06, 07, 1213, 14, 15, 20, 2122, 23, 28, 29, 30 16, 17, 18, 19, 2021, 22, 23, 24, 2526, 27, 28, 29, 30 01, 03, 05, 07, 0911, 13, 15, 17, 1921, 23, 25, 27, 29 08, 09, 10, 11, 1213, 14, 15, 24, 2526, 27, 28, 29, 30 02, 03, 06, 07, 3010, 11, 14, 15, 1819, 22, 23, 26, 27 1~ 30까지 중의 숫자를 임의로 생각해서 각 번호 그룹에 숫자가 있으면 그룹 맨 앞의 숫자를 더하고 없으면 더하지않고 다음 그룹으로 넘어가는 코드를 구현해package magic; import java.util.Scan..
package ex5; public class Ex1_for {public static void main(String[] args) {// for 문 :// 특정 명령을 원하는 만큼 반복적으로 처리할 때 사용for (int i = 0; i = 1; i--){System.out.println(i);}//1부터 10까지 반복하는 문장에서 3의 배수만 출력해 보자for(int i = 1; i
package ex4; import java.util.Scanner; public class Ex4_switch_work {public static void main(String[] args) {/* * 키보드에서 정수 두 개를 입력받는다. * 그리고 연산자를 입력 받는다. *마지막으로 입력받은 연산자를 switch 문으로 구별하여 처음의 정수 두개의 연산을 *수행하는 코드를 작성 */Scanner sc = new Scanner(System.in);int first = 0;int second = 0;int result = 0;String str = "";System.out.println("첫번째 숫자 입력 ");first = sc.nextInt();System.out.println("두번째 숫자 입력 "..
package ex4; import java.util.Scanner; public class Ex3_scanner {public static void main(String[] args) {System.out.println("정수를 입력하세요"); //키보드의 값을 입력받기 위한 scanner 클래스Scanner sc = new Scanner(System.in);switch (sc.nextInt()) {case 1:System.out.println("1번");break;case 2:System.out.println("2번");break;case 3:System.out.println("3번");break;default:break;}}}
package ex4; public class Ex2_switch {public static void main(String[] args) {String str = "미";String result = "";switch (str) {case "수":result = "90~100점";break;case "우":result = "80~90점";break;case "미":result = "70~80점";break;case "양":result = "60~70점";break;case "가":result = "50~60점";break;default:result = "점수 외";break;}System.out.println(result);}}
package ex3; public class Ex3_if {public static void main(String[] args) {// 다중 if (else if)// 여러개의 조건비교가 필요한 경우int num = 75;String str = ""; if (num >= 90) {str = "수";} else if (num >= 80) {str = "우";} else if (num >= 70) {str = "미";} else if (num >= 60) {str = "양";} else if (num < 60) {str = "가";} else {str = "성적에러";} System.out.println(str);}}
package ex3; public class Ex2_if {public static void main(String[] args) {// if ~ else 문int n = 49;String str = ""; if (++n >= 50) {str = "n은 50 이상의 수";} else {str = "n은 50 이하의 수";} System.out.println(str); //변수 age에 나이를 대입하고 나이가 30이상이면//드실만큼 드셨네요, 그렇지 않으면 더 드세요//를 출력하는 if 문을 구현한 후 //마지막으로 감사합니다. 라는 문장이 출력되도록 한다int age = 25;if(age >=30 ){str = "드실만큼 드셨네요";} else {str = "더 드세요";}System.out.printl..