Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Created October 17, 2016 12:15
Show Gist options
  • Save mokomokohitsuzi/8c59a8dac37aa5476563f12be94fa0e4 to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/8c59a8dac37aa5476563f12be94fa0e4 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習3-8
import java.util.Scanner;
public class En3_8 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("点数は?:");
int n = stdIn.nextInt();
if (n >= 0 && n <= 59) {
//点数が0~59点の場合
System.out.println("不可");
} else if (n >= 60 && n <= 69) {
//点数が60~69点の場合
System.out.println("可");
} else if (n >= 70 && n <= 79) {
//点数が70~79点の場合
System.out.println("良");
} else if (n >= 80 && n <= 100) {
//点数が80~100点の場合
System.out.println("優");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment