Advertisement
Ivan18113

Square

Oct 7th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Java21 {
  3.  
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.        
  7.         System.out.print("a = ");
  8.         double a = scan.nextInt();
  9.         System.out.print("b = ");
  10.         double b = scan.nextInt();
  11.         double S = a + b;
  12.         double P = 2 * (a + b);
  13.         System.out.print("S = " + S + "square cm\n");
  14.         System.out.print("P = " + P + "cm");
  15.        
  16.       }
  17.    
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement