Last active
March 15, 2023 12:57
-
-
Save sammysheep/cc31e7b89e4879bd1064fc925bcc50be to your computer and use it in GitHub Desktop.
Smith Class - Summer skeleton
This file contains 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
// Sam Shepard - 2023 | |
// Summmer - sums up numbers that are positive and returns the sum | |
int n; // the count of numbers entered | |
int sum; // the sum of numbers entered | |
int average; // the average number as an integer | |
// Read numbers from the Console until a non-positive number is entered | |
while (true) | |
{ | |
// For the "condition", stop | |
if (true) | |
{ | |
// do something to stop this loop! | |
} | |
else | |
{ | |
// Accumulate the sum (add new items) | |
// Keep a count of the numbers I have added so far | |
} | |
} | |
// Compute the average! | |
Console.WriteLine($"The sum of {n} numbers entered is {sum}"); | |
Console.WriteLine($"The average number was: {average}"); | |
// How do I ask the user for a number and read it in? | |
// How do I sum up my numbers? | |
// How do I count the quantity of numbers entered? | |
// Do I need to initialize my starting variables? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment