Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Cake {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double l = Double.parseDouble(scanner.nextLine());
- double w = Double.parseDouble(scanner.nextLine());
- double volume = l * w;
- double result = 0;
- double pieces;
- //String str = " ";
- while (result <= volume) {
- double num = Double.parseDouble(scanner.nextLine());
- result += num;
- if (str.equals("STOP")){
- String str = scanner.nextLine();
- pieces = Math.abs(result - volume);
- }
- } pieces = Math.abs(result - volume);
- System.out.println(pieces);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement