Advertisement
Guest User

Untitled

a guest
Jun 8th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class goDev {
  4.     public static void main(String[] args) {
  5.         Scanner sc = new Scanner(System.in);
  6.  
  7.         int shir = Integer.parseInt(sc.nextLine());
  8.         int dal = Integer.parseInt(sc.nextLine());
  9.         int vis = Integer.parseInt(sc.nextLine());
  10.         int staq = shir * dal * vis;
  11.  
  12.         String isDone = "";
  13.  
  14.         while (!isDone.equals("Done")) {
  15.             isDone = sc.nextLine();
  16.             if (isDone.equals("Done")){
  17.                 break;
  18.             }
  19.             int kashon = Integer.parseInt(isDone);
  20.             staq -= kashon;
  21.  
  22.             if (staq <= 0) {
  23.                 break;
  24.             }
  25.         }   if (isDone.equals("Done")) {
  26.             System.out.printf("%d Cubic meters left.", Math.abs(staq));
  27.         } else {
  28.             System.out.printf("No more free space! You need %d Cubic meters more.", Math.abs(staq));
  29.         }
  30.  
  31.         }
  32.  
  33.  
  34.  
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement