Skip to content

Commit 2dcb5a9

Browse files
committed
FizzBuzz
- Update code comments - Pause application before exit
1 parent 5c93a7f commit 2dcb5a9

File tree

8 files changed

+9
-0
lines changed

8 files changed

+9
-0
lines changed

.vs/slnx.sqlite

0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.

FizzBuzz/FizzBuzz/FizzBuzz/Program.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ static void Main(string[] args)
2828
Console.WriteLine("FizzBuzz");
2929
Console.WriteLine("--------\n");
3030

31+
/* Ask the user for the number to START the RANGE */
32+
3133
Console.Write("Please enter the NUMBER for START of the RANGE: "); // Ask the user to enter a whole number
3234
startNum = Convert.ToDouble(Console.ReadLine()); // Take the inputted user string, convert to type int and store in variable startNum
3335

36+
// CHECK IF NUMBER ENTERED IS A WHOLE NUMBER AND IS NOT ZERO
37+
3438
bool startInt = startNum == (int)startNum; // Check if the number entered is a whole number with no decimal places
3539
if (startInt == false) // If it is not a whole number
3640
{
@@ -43,9 +47,13 @@ static void Main(string[] args)
4347
continue; // Restart the loop and get the user enter a number again
4448
} // End ELSE IF
4549

50+
/* Ask the user for the number to END the RANGE */
51+
4652
Console.Write("Please enter the NUMBER for the END of the RANGE: "); // Ask the user to enter a whole number
4753
endNum = Convert.ToDouble(Console.ReadLine()); // Take the inputted user string, convert to type int and store in variable startNum
4854

55+
// CHECK IF NUMBER ENTERED IS A WHOLE NUMBER AND IS NOT ZERO
56+
4957
bool endInt = endNum == (int)endNum; // Check if the number entered is a whole number with no decimal places
5058
if (endInt == false) // If it is not a whole number
5159
{
@@ -84,6 +92,7 @@ static void Main(string[] args)
8492
string sequence = FizzBuzz.FizzBuzzLogic(Convert.ToInt32(startNum), Convert.ToInt32(endNum));
8593

8694
Console.WriteLine(sequence); // Output the value of sequence to the console
95+
Console.ReadKey(); // Pause the application before exiting
8796
break; // As we have successfully validated the user input and run the FizzBuzz logic, and displayed the result, we can break the loop and end the application
8897

8998
} //End WHILE
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)