Guest User

Untitled

a guest
Oct 10th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01._Dishwasher
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int bottles = int.Parse(Console.ReadLine());
  10. int detergentVol = bottles * 750;
  11. string input = string.Empty;
  12. int dishes = 0;
  13. int counter = 0;
  14. int plates = 0;
  15. int pots = 0;
  16.  
  17. while (true)
  18. {
  19. input = Console.ReadLine();
  20.  
  21. if (input == "End")
  22. {
  23. break;
  24. }
  25. counter++;
  26.  
  27. if (counter % 3 == 0)
  28. {
  29. dishes = int.Parse(input);
  30. pots += dishes;
  31. detergentVol -= dishes * 15;
  32. }
  33. else
  34. {
  35. dishes = int.Parse(input);
  36. plates += dishes;
  37. detergentVol -= dishes * 5;
  38. }
  39. if (detergentVol < 0)
  40. {
  41. Console.WriteLine($"Not enough detergent, {Math.Abs(detergentVol)} ml. more necesary!");
  42. return;
  43. }
  44. }
  45. Console.WriteLine($"Detergent was enough!");
  46. Console.WriteLine($"{plates} dishes and {pots} pots were washed.");
  47. Console.WriteLine($"Leftover detergent {detergentVol} ml.");
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment