Skip to content

Instantly share code, notes, and snippets.

@sgoguen
Created January 11, 2017 03:36
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 sgoguen/840d776351f0f62c2cdc950043900189 to your computer and use it in GitHub Desktop.
Save sgoguen/840d776351f0f62c2cdc950043900189 to your computer and use it in GitHub Desktop.
void Main() {
string line;
int runningTotal = 0, input = 0;
do {
line = Console.ReadLine();
if (Int32.TryParse(line, out input)) {
runningTotal += input;
Console.WriteLine(runningTotal);
} else if (line == "quit" || line == null) {
return;
}
} while (line != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment