## Lesson #4 - The Quiz

This lesson will cover the use of a while loop. You will also learn how to add 1 and subtract 1 to a variable simply by placing either a ++ or -- respectively, after the variable name.

Code:
```

using System;

namespace WhileLoop

{

///<summary>

/// Demonstration of While Loop

///</summary>

class Class1

{

///<summary>

/// Ask a series of math questions and score the individual

///</summary>

static void Main(string[] args)

{

//if we don't initialize you will get an error

int score = 0;

Console.WriteLine("It will be repeated if answered wrong.");

Console.WriteLine();

{

Console.Write("What is 4/2?: ");

{

//take away 1 from score if condition is met

//that is, answerOne not equal to 2

score--;

}

score++;

Console.WriteLine("Good job! Next Question:");

Console.WriteLine();

{

Console.Write("What is 2/4: ");

//We Convert.ToDouble since the answer is a real #

{

score--;

}//end if statement

score++;

Console.WriteLine("");

Console.WriteLine("You completed the quiz");

}

}

}```