Advertisement
bullit3189

On Time For The Exam

Nov 14th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 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 _07OnTimeForTheExam
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int examH = int.Parse(Console.ReadLine());
  14. int examM = int.Parse(Console.ReadLine());
  15. int arrH = int.Parse(Console.ReadLine());
  16. int arrM = int.Parse(Console.ReadLine());
  17.  
  18. int examTimeInMin = (examH * 60) + examM;
  19. int arrTimeInMin = (arrH * 60) + arrM;
  20.  
  21. if (examTimeInMin < arrTimeInMin)
  22. {
  23. Console.WriteLine("Late");
  24.  
  25. int diff = arrTimeInMin - examTimeInMin;
  26.  
  27. if (diff<60)
  28. {
  29. Console.WriteLine("{0} minutes after the start",diff);
  30. }
  31.  
  32. else
  33.  
  34. {
  35. int diffMin = diff % 60;
  36. int diffHrs = diff / 60;
  37.  
  38. Console.WriteLine("{0}:{1:D2} hours after the start",diffHrs,diffMin);
  39. }
  40. }
  41. else if (examTimeInMin == arrTimeInMin)
  42. {
  43. Console.WriteLine("On time");
  44. }
  45. else if (examTimeInMin - arrTimeInMin <=30)
  46. {
  47. Console.WriteLine("On time");
  48.  
  49. int diff = examTimeInMin - arrTimeInMin;
  50. Console.WriteLine("{0} minutes before the start",diff);
  51. }
  52. else if (examTimeInMin - arrTimeInMin >30)
  53. {
  54. Console.WriteLine("Early");
  55.  
  56. int diff = examTimeInMin - arrTimeInMin;
  57.  
  58. if (diff<60)
  59. {
  60. Console.WriteLine("{0} minutes before the start", diff);
  61. }
  62. else
  63.  
  64. {
  65. int diffMin = diff % 60;
  66. int diffHrs = diff / 60;
  67.  
  68. Console.WriteLine("{0}:{1:D2} hours before the start", diffHrs, diffMin);
  69. }
  70. }
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement