Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Five-weekends/Dart/five-weekends.dart
Normal file
13
Task/Five-weekends/Dart/five-weekends.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
main() {
|
||||
var total = 0;
|
||||
var empty = <int>[];
|
||||
for (var year = 1900; year < 2101; year++) {
|
||||
var months =
|
||||
[1, 3, 5, 7, 8, 10, 12].where((m) => DateTime(year, m, 1).weekday == 5);
|
||||
print('$year\t$months');
|
||||
total += months.length;
|
||||
if (months.isEmpty) empty.add(year);
|
||||
}
|
||||
print('Total: $total');
|
||||
print('Year with none: $empty');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue