JAVA/4. Array
배열예제 14
날아올라↗↗
2016. 6. 22. 17:05
728x90
반응형
- package test.com;
- import java.util.Scanner;
- public class WhyNeedArray {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int fstHighScore = 0;
- int sndHighScore = 0;
- Scanner sc = new Scanner(System.in);
- System.out.println("점수입력");
- int score1 = sc.nextInt();
- if (score1 >= fstHighScore) {
- sndHighScore = fstHighScore;
- fstHighScore = score1;
- } else if (score1 < fstHighScore && score1 > sndHighScore) {
- sndHighScore = score1;
- }
- System.out.println("점수입력");
- int score2 = sc.nextInt();
- if (score2 >= fstHighScore) {
- sndHighScore = fstHighScore;
- fstHighScore = score2;
- } else if (score2 < fstHighScore && score2 > sndHighScore) {
- sndHighScore = score2;
- }
- System.out.printf("학점은 %d점 이상입니다.", sndHighScore);
- }
- }
728x90
반응형