Pretorianbg

three brothers

Sep 23rd, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Three_brothers
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double brotherA = double.Parse(Console.ReadLine());
  14. double brotherB = double.Parse(Console.ReadLine());
  15. double brotherC = double.Parse(Console.ReadLine());
  16. double fatherfishing = double.Parse(Console.ReadLine());
  17.  
  18. double cleaningtime = 1 / (1/brotherA + 1/brotherB + 1/brotherC);
  19. double cleaningbreak = cleaningtime * 0.15;
  20. cleaningtime = cleaningtime + cleaningbreak;
  21.  
  22. Console.Write("Cleaning time: ");
  23. Console.WriteLine($"{cleaningtime:F2}");
  24.  
  25. if (cleaningtime<=fatherfishing)
  26. {
  27. double timeleft = fatherfishing - cleaningtime;
  28. Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(timeleft)} hours.");
  29. }
  30. else
  31. {
  32. Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Ceiling(cleaningtime-fatherfishing)} hours.");
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment