Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package JavaSyntax;
- import java.util.Scanner;
- public class P01_RectangleArea1 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double sideA = 0;
- double sideB = 0;
- if (scanner.hasNextInt()) {
- sideA = scanner.nextInt();
- } else if (scanner.hasNextDouble()) {
- sideA = scanner.nextDouble();
- }
- if (scanner.hasNextInt()) {
- sideB = scanner.nextInt();
- } else if (scanner.hasNextDouble()) {
- sideB = scanner.nextDouble();
- }
- double area = sideA*sideB;
- System.out.printf("%.2f", area);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement