Skip to content

Instantly share code, notes, and snippets.

@kimtg
Last active July 23, 2021 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimtg/5613be330706f25fc8d756942d3c70d1 to your computer and use it in GitHub Desktop.
Save kimtg/5613be330706f25fc8d756942d3c70d1 to your computer and use it in GitHub Desktop.
using namespace System
$r=[Random]::new()
$score = 0
while ($true) {
$a = $r.Next(0,10)
$b = $r.Next(0,10)
$c = 0
$answer = $a + $b
if ([int]::TryParse((read-host $a "+" $b), [ref]$c) -and $c -eq $answer) {
$score++
echo ("정답. 점수=" + $score)
} else {
echo ("오답. 정답=" + $answer)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment