Created with <3 with dartpad.dev.
Created
August 19, 2022 07:14
-
-
Save faizan1947/91a1def3982e0ce4d13c1990adafc6eb to your computer and use it in GitHub Desktop.
for loop challenge
This file contains 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 characters
List<int> winningNumbers = [12, 6, 34, 22, 41, 9]; | |
void main() { | |
List<int> ticket1 = [45, 2, 9, 18, 12, 33]; | |
List<int> ticket2 = [41, 17, 26, 32, 7, 35]; | |
checkNumbers(ticket2); | |
} | |
void checkNumbers(List<int> myNumbers) { | |
int matches=0; | |
for(int myNum in myNumbers){ | |
for(int winningNum in winningNumbers){ | |
if(winningNum==myNum){ | |
matches++; | |
} | |
} | |
} | |
print('you have $matches matches'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment