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
//Higest of Three Numbers | |
//get first, second & third | |
Double first, second, third, highest; | |
String message; | |
Console.WriteLine("Enter first number"); | |
first = Double.Parse(Console.ReadLine()); | |
Console.WriteLine("Enter second number"); | |
second = Double.Parse(Console.ReadLine()); |
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
Double score1, score2, score3, gold, silver, bronze; | |
Console.WriteLine("Enter 3 scores, press enter after each"); | |
score1 = Double.Parse(Console.ReadLine()); | |
score2 = Double.Parse(Console.ReadLine()); | |
score3 = Double.Parse(Console.ReadLine()); | |
if (score1 > score2) | |
{ | |
gold = score1; | |
silver = score2; |
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
Char letter; | |
String message; | |
Console.WriteLine("Enter letter grade A, B, C, D, F"); | |
letter = Char.ToUpper(Char.Parse(Console.ReadLine())); | |
//Char.ToUpper converts lower to upper case, case 'a' 'b' ... 'f' | |
//becomes redundant. | |
switch (letter) |
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
Int32 n, nFactorial; | |
Console.WriteLine("Factorial Calculator!!!"); | |
Console.WriteLine("Enter n value"); | |
n = Int32.Parse(Console.ReadLine()); | |
nFactorial = 1; | |
while (n > 1) //no semi-colon | |
{ //new //old | |
nFactorial = nFactorial * n; | |
n = n - 1; |
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
Int32 n, nFactorial; | |
Console.WriteLine("Factorial Calculator!!!"); | |
Console.WriteLine("Enter n value"); | |
n = Int32.Parse(Console.ReadLine()); | |
nFactorial = 1; | |
for (nFactorial = 1; n > 1; n--) | |
nFactorial *= n; | |
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
Int32 count = 0, current = 0, previous = 1, previousPrevious = 0, n; | |
Console.WriteLine("Fibonacci Series"); | |
Console.WriteLine("How many numbers should display in the sequence?"); | |
n = Int32.Parse(Console.ReadLine()); | |
while (count < n) | |
{ | |
Console.WriteLine(current); | |
previousPrevious = previous; |
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
Int32 n, nFactorial, count; | |
Char response; | |
Console.WriteLine("Welcome to the Factorial Calculator.. again"); | |
do | |
{ | |
Console.WriteLine("Please enter a value for 'n'"); | |
n = Int32.Parse(Console.ReadLine()); | |
nFactorial = 1; |
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
//SIN Number Validator | |
Int32 sin, first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, sumOfDigits; | |
Console.WriteLine("Enter SIN"); | |
sin = Int32.Parse(Console.ReadLine()); | |
first = sin / 100000000; | |
second = sin % 100000000 / 10000000; | |
third = sin % 10000000 / 1000000; |
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
static void Main(string[] args) | |
{ | |
Char menuItem; | |
Console.WriteLine("Welcome to ze calculator"); | |
menuItem = GetMenuItem(); | |
while (menuItem != 'X') | |
{ | |
ProcessMenuItem(menuItem); | |
menuItem = GetMenuItem(); | |
}// while |
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
static void Main(string[] args) | |
{ | |
//The MAXPLAYERS constant is the physical table size | |
const Int32 MAXPLAYERS = 23; | |
//Declare the player tables | |
Int32[] playerNumbers = new Int32[MAXPLAYERS]; | |
String[] playerLastNames = new String[MAXPLAYERS]; | |
Int32[] playerPoints = new Int32[MAXPLAYERS]; |