Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1.         import java.util.Scanner;
  2.  
  3. public class P7_2DRectangleArea { //purva otvarqsha
  4.     public static void main(String[] args) { //vtora otvarqsha skoba
  5.         Scanner scanner = new Scanner(System.in);
  6.         double x1 = Double.parseDouble(scanner.nextLine());
  7.         double y1 = Double.parseDouble(scanner.nextLine());
  8.         double x2 = Double.parseDouble(scanner.nextLine());
  9.         double y2 = Double.parseDouble(scanner.nextLine());
  10.         double a = Math.abs(y1 - y2);
  11.         double b = Math.abs(x1 - x2);
  12.         double area = a * b;
  13.         double perimeter = 2 * (a + b);
  14.         System.out.println(area);
  15.         System.out.println(perimeter);
  16. //tuk lipsvaha dve zatvarqshi skobi
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement