Skip to content

Instantly share code, notes, and snippets.

@Abdulazeez5897
Last active May 29, 2025 11:39
Show Gist options
  • Save Abdulazeez5897/a9b6535bd897bd5392ef2897fa3d1ae8 to your computer and use it in GitHub Desktop.
Save Abdulazeez5897/a9b6535bd897bd5392ef2897fa3d1ae8 to your computer and use it in GitHub Desktop.
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