Created
March 12, 2021 21:07
-
-
Save ibrohimkhan/1ca1fee7313e595dd73c87f849926eb4 to your computer and use it in GitHub Desktop.
Revisions
-
ibrohimkhan created this gist
Mar 12, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ import 'dart:io'; void main(List<String> arguments) { task1(); } void task1() { var month = 8; switch (month) { case 1: print('January'); break; case 2: print('February'); break; case 3: print('March'); break; case 4: print('April'); break; case 5: print('May'); break; case 6: print('June'); break; case 7: print('July'); break; case 8: print('August'); break; case 9: print('September'); break; case 10: print('October'); break; case 11: print('November'); break; case 12: print('December'); break; default: print('There is no such month'); } } void task2() { // step 2 is used to avoid looping 100 times for (var i = 0; i < 100; i += 2) { print('i = $i'); } } void task3() { var sum = 0; while (true) { var data = stdin.readLineSync(); if (data == 'stop') break; var number = num.tryParse(data); if (number == null) continue; sum += number; } print('sum is $sum'); }