Created
November 25, 2016 14:00
-
-
Save mokomokohitsuzi/80979bbb1106e8b835b7df89cbcf28bc to your computer and use it in GitHub Desktop.
新・明解Java入門 演習5-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class En05_02 { | |
public static void main(String[] args) { | |
Scanner stdIn = new Scanner(System.in); | |
System.out.println("変数xはfloat型で、変数yはdouble型です。"); | |
System.out.print("x :"); | |
float x = stdIn.nextFloat(); | |
System.out.print("y :"); | |
double y = stdIn.nextDouble(); | |
//float型は約5~7桁 | |
System.out.println("x = " + x); | |
//double型は約15桁 | |
System.out.println("y = " + y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment