Created
March 17, 2019 08:24
-
-
Save simonpham/c4ccadce377212c123cf4c7aa517dde7 to your computer and use it in GitHub Desktop.
Đoán số
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
int randomNumber = rand() % (1000 - 0 + 1) + 1000; | |
int falseCount = -1; | |
int guessNumber = -1; | |
while (guessNumber != randomNumber) { | |
falseCount++; | |
print("Guess a number: "); | |
guessNumber = <USER_INPUT_FROM_KEYBOARD>; | |
if (guessNumber < random) { | |
print("Too low, try again."); | |
} | |
if (guessNumber > random) { | |
print("Too high, try again."); | |
} | |
} | |
print("Mày đoán đúng rồi!"); | |
if (falseCount > 10) { | |
printf("Mày tốn %d lần mới đoán trúng, mày gà vl!", falseCount); | |
} else { | |
printf("Mày tốn có %d lần mà đã đoán trúng, mày pro vl!", falseCount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment