Advertisement
mmayoub

חישוב שטח והיקף של מלבן

Nov 25th, 2022
1,232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | Software | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.     public static void main(String[] args) {
  5.         Scanner myScanner = new Scanner(System.in);
  6.  
  7.         System.out.print("Enter rectangle width: ");
  8.         double x = myScanner.nextDouble();
  9.         System.out.print("Enter rectangle height: ");
  10.         double y = myScanner.nextDouble();
  11.         myScanner.close();
  12.  
  13.         double s = x * y;
  14.         double p = 2 * (x + y);
  15.  
  16.         System.out.println("rectangle width is: " + x);
  17.         System.out.println("rectangle height is: " + y);
  18.         System.out.println("rectangle area is: " + s);
  19.         System.out.println("rectangle perimeter is: " + p);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement