java(481)
-
ContinueEx02-3의 배수가 아니거나 7의 배수가 아니라면 출력하고 카운트 증가시키기
3의 배수가 아니거나 7의 배수가 아니라면 출력하고 카운트 증가시키기 소스코드 public class ContinueEx02 { public static void main(String[] args) { int num=0; int count=0; while((num++)
-
ForEx03.java-for문
1부터 100까지의 누적 합 구하기 소스코드 public class ForEx03 { public static void main(String[] args) { int total = 0; for(int i=1; i
-
ForEx02.java-비교인자값 감소/증가 시키기
비교인자값 감소/2씩 증가시키기 소스코드 public class ForEx02 { public static void main(String[] args) { // 비교인자값 감소 System.out.println("비교 인자값 1씩 감소 시키기:"); for(int i=5; i>=1; i--){ System.out.print("\t"+ i); } System.out.println(); System.out.println("\t프로그램 종료!"); // 비교인자값 2씩 증가시키기 System.out.println(); System.out.println("비교 인자값 2씩 증가시키기 1:"); for(int i=0; i
-
ForEx01.java-for()문, 비교 인자값 증가
비교 인자값 증가 소스코드 public class ForEx01 { public static void main(String[] args) { for( int i=1; i
-
SwitchEx05-no break/switch+break
switch~case문과 switch~case~default 레이블 유무에 따른 출력결과 확인 소스코드 public class SwitchEx05 { public static void main(String[] args) { int n=3; // int n=7; // int n=10; switch(n) { case 1: System.out.println("First"); case 2: System.out.println("Second"); case 3: System.out.println("Thrid"); case 4: System.out.println("Fourth"); case 5: System.out.println("Fifth"); case 6: System.out.println("Sixth"); cas..
-
IfEx03.java-다중 if문 ( 성적 등급 처리)
조건문 - 다중 if문 ( 성적 등급 처리) 소스코드 public class IfEx03 { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); int score; char grade; System.out.print("성적을 입력하세요 > "); score = input.nextInt(); if( score >= 90 && score = 80 && score = 70 && score =60 && score