Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class addMinutesMonths
- {
- static void Main()
- {
- // ADD minutes
- Console.Write("The time is 10:53");
- int hour = 10;
- int minutes = 53;
- Console.WriteLine(". What's the time after 10 minutes?");
- int minutesPlusTen = minutes + 10; // 53 + 10 = 63 minutes
- hour = hour + (minutesPlusTen / 60); // 10 + (63/60) = 11h
- minutes = minutesPlusTen % 60; // 63 % 60 = 3min
- Console.WriteLine(hour + ":0" + minutes);
- Console.WriteLine();
- // ADD months
- Console.Write("This is the 10th month. ");
- int month = 10;
- Console.WriteLine("Add 5 months to it.");
- int addFive = month + 5; // 10 + 5 = 15
- Console.WriteLine("Which month do we get? It is the: ");
- month = addFive % 12; // 15 % 12 = 3;
- Console.WriteLine(month);
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement