Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner myScanner = new Scanner(System.in);
- System.out.print("Enter square side length: ");
- double x = myScanner.nextDouble();
- myScanner.close();
- double s = x * x; // s = Math.pow(x,2);
- double p = 4 * x;
- System.out.println("Square side length is: " + x);
- System.out.println("Square area is: " + s);
- System.out.println("Square perimeter is: " + p);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement