Last active
May 29, 2025 11:39
-
-
Save Abdulazeez5897/a9b6535bd897bd5392ef2897fa3d1ae8 to your computer and use it in GitHub Desktop.
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 characters
import 'dart:math'; | |
void main() { | |
print('Keep trying till you win'); | |
dynamic random = Random(); | |
int randomNum = random.nextInt(100); | |
int attempt = 0; | |
attempt ++; | |
if (randomNum == 7){ | |
print("$randomNum you won"); | |
print("$attempt attempt"); | |
}else if (randomNum <= 4) { | |
print("$randomNum Too low! Try again."); | |
}else if (randomNum >= 8){ | |
print("$randomNum Too high! Try again."); | |
}else{ | |
print('$randomNum keep tryng'); | |
} | |
print("You've attemted this guess $attempt times"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment