Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package kr_2;
- import java.util.*;
- public class MathSuperstar {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String[] input = sc.nextLine().split(",");
- double r1 = Double.parseDouble(input[0]) / 10;
- double h1 = Double.parseDouble(input[1]) / 10;
- double r2 = Double.parseDouble(input[2]) / 10;
- double h2 = Double.parseDouble(input[3]) / 10;
- double V1 = Math.PI * r1 * r1 * h1;
- double V2 = Math.PI * r2 * r2 * h2;
- if (Math.abs(V1 - V2) < 0.01) {
- System.out.printf("V1=V2=%.2f", V1);
- } else if (V1 > V2) {
- System.out.printf("V1=%.2f", V1);
- } else {
- System.out.printf("V2=%.2f", V2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement