0) { System.out.println(a + "는 양수입니다."); } //이름, 국어점수, 영어점수, 수학점수 입력 받아서 총점, 평균 학점 구하세요. System.out.print("이름 : "); String name=sc.next(); System.out.print("국어점수 : "); int kor=sc.nextInt(); System.out.print("영어점수 : "); int eng=sc.nextInt(); System.out.print("수학점수 : "); int math=sc.nextInt(); int total=kor+eng+math; float avg=(float)total/3; System.out.println("총점 : " + total); System.out.println("평균점수 : " + avg); String grade=null; if(avg>=90) { grade="수"; }else if(avg>=80) { grade="우"; }else if(avg>=70) { grade="미"; }else if(avg>=60) { grade="양"; }else if(avg>=50) { grade="가"; } System.out.println("학점 : " + grade); sc.close(); } }"> 0) { System.out.println(a + "는 양수입니다."); } //이름, 국어점수, 영어점수, 수학점수 입력 받아서 총점, 평균 학점 구하세요. System.out.print("이름 : "); String name=sc.next(); System.out.print("국어점수 : "); int kor=sc.nextInt(); System.out.print("영어점수 : "); int eng=sc.nextInt(); System.out.print("수학점수 : "); int math=sc.nextInt(); int total=kor+eng+math; float avg=(float)total/3; System.out.println("총점 : " + total); System.out.println("평균점수 : " + avg); String grade=null; if(avg>=90) { grade="수"; }else if(avg>=80) { grade="우"; }else if(avg>=70) { grade="미"; }else if(avg>=60) { grade="양"; }else if(avg>=50) { grade="가"; } System.out.println("학점 : " + grade); sc.close(); } }"> 0) { System.out.println(a + "는 양수입니다."); } //이름, 국어점수, 영어점수, 수학점수 입력 받아서 총점, 평균 학점 구하세요. System.out.print("이름 : "); String name=sc.next(); System.out.print("국어점수 : "); int kor=sc.nextInt(); System.out.print("영어점수 : "); int eng=sc.nextInt(); System.out.print("수학점수 : "); int math=sc.nextInt(); int total=kor+eng+math; float avg=(float)total/3; System.out.println("총점 : " + total); System.out.println("평균점수 : " + avg); String grade=null; if(avg>=90) { grade="수"; }else if(avg>=80) { grade="우"; }else if(avg>=70) { grade="미"; }else if(avg>=60) { grade="양"; }else if(avg>=50) { grade="가"; } System.out.println("학점 : " + grade); sc.close(); } }">
package ch02.control;

import java.util.Scanner;

public class Exam17 {

	public static void main(String[] args) {
		//어떤 수를 입력해서 양수를 출력해라
		
		Scanner sc = new Scanner(System.in);
		System.out.println("어떤수를 입력하세요.");
		int a=sc.nextInt();
		
		if(a>0) {
			System.out.println(a + "는 양수입니다.");
		}
	
		//이름, 국어점수, 영어점수, 수학점수 입력 받아서 총점, 평균 학점 구하세요.
		
		System.out.print("이름 : ");
		String name=sc.next();
		System.out.print("국어점수 : ");
		int kor=sc.nextInt();
		System.out.print("영어점수 : ");
		int eng=sc.nextInt();
		System.out.print("수학점수 : ");
		int math=sc.nextInt();
		
		int total=kor+eng+math;
		float avg=(float)total/3;
		System.out.println("총점 : " + total);
		System.out.println("평균점수 : " + avg);
		
		String grade=null;		
		if(avg>=90) {
			grade="수";
		}else if(avg>=80) {
			grade="우";
		}else if(avg>=70) {
			grade="미";
		}else if(avg>=60) {
			grade="양";
		}else if(avg>=50) {
			grade="가";
		}
		
		System.out.println("학점 : " + grade);
		
		sc.close();

	}

}
어떤수를 입력하세요.
30
30는 양수입니다.
이름 : 홍길동
국어점수 : 70
영어점수 : 90
수학점수 : 100
총점 : 260
평균점수 : 86.666664
학점 : 우