Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Pravougulnik {
  4.     public static void main(String[] args) {
  5.         Scanner input = new Scanner(System.in);
  6.        
  7.         double x1 = Double.parseDouble(input.nextLine());
  8.         double y1 = Double.parseDouble(input.nextLine());
  9.         double x2 = Double.parseDouble(input.nextLine());
  10.         double y2 = Double.parseDouble(input.nextLine());
  11.        
  12.         double lenght = Math.abs(x1 - x2);
  13.         double widht = Math.abs(y1 - y2);
  14.         double area = lenght*widht;
  15.         double perimeter = 2*(lenght+widht);
  16.        
  17.         System.out.println(area);
  18.         System.out.println(perimeter);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement