30 lines
827 B
C#
30 lines
827 B
C#
|
count_to(5);
|
|||
|
|
|||
|
void count_to(int max) {
|
|||
|
for (int i = 0; i < max; i++) {
|
|||
|
Console.Write($"{i}, ");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
int[] schedule = {800, 1200, 1600, 2000};
|
|||
|
|
|||
|
void display_adjusted_times(int[] times, int current_GMT, int new_GMT) {
|
|||
|
int diff = 0;
|
|||
|
if (Math.Abs(new_GMT) > 12 || Math.Abs(current_GMT) > 12){
|
|||
|
Console.WriteLine("Invalid GMT");
|
|||
|
} else if (
|
|||
|
new_GMT <= 0 && current_GMT <= 0 ||
|
|||
|
new_GMT >= 0 && current_GMT >= 0
|
|||
|
){
|
|||
|
diff = 100 * (Math.Abs(new_GMT) - Math.Abs(current_GMT));
|
|||
|
} else {
|
|||
|
diff = 100 * (Math.Abs(new_GMT) + Math.Abs(current_GMT));
|
|||
|
}
|
|||
|
for (int i=0; i<times.Length; i++){
|
|||
|
int new_time = ((times[i] + diff)) % 2400;
|
|||
|
Console.WriteLine($"{times[i]} -> {new_time}");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
display_adjusted_times(schedule, 6, -6);
|