Advertisement
mmayoub

חישוב שטח והיקף של ריבוע

Nov 25th, 2022 (edited)
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 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 square side length: ");
  8.         double x = myScanner.nextDouble();
  9.         myScanner.close();
  10.  
  11.         double s = x * x; // s = Math.pow(x,2);
  12.         double p = 4 * x;
  13.  
  14.         System.out.println("Square side length is: " + x);
  15.         System.out.println("Square area is: " + s);
  16.         System.out.println("Square perimeter is: " + p);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement