Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pravougulnik {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- double x1 = Double.parseDouble(input.nextLine());
- double y1 = Double.parseDouble(input.nextLine());
- double x2 = Double.parseDouble(input.nextLine());
- double y2 = Double.parseDouble(input.nextLine());
- double lenght = Math.abs(x1 - x2);
- double widht = Math.abs(y1 - y2);
- double area = lenght*widht;
- double perimeter = 2*(lenght+widht);
- System.out.println(area);
- System.out.println(perimeter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement