Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class Pythagoras {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- double a, b, c, s;
- System.out.println("Enter the values of a and b:");
- a = in.nextDouble();
- b = in.nextDouble();
- c = Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
- s = (a*b)/2;
- System.out.printf("The value of c is %.3f, the surface area is %.3f.", c, s);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment