Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner myScanner = new Scanner(System.in);
- System.out.print("Enter rectangle width: ");
- double x = myScanner.nextDouble();
- System.out.print("Enter rectangle height: ");
- double y = myScanner.nextDouble();
- myScanner.close();
- double s = x * y;
- double p = 2 * (x + y);
- System.out.println("rectangle width is: " + x);
- System.out.println("rectangle height is: " + y);
- System.out.println("rectangle area is: " + s);
- System.out.println("rectangle perimeter is: " + p);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement