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
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
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; | |
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 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
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
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
//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
//Higest of Two Numbers #1 | |
//get first and second | |
Double first, second, 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 aSide, bSide, cSide; | |
Console.WriteLine("Enter the value of side A"); | |
aSide = double.Parse(Console.ReadLine()); | |
Console.WriteLine("Enter the value of side B"); | |
bSide = double.Parse(Console.ReadLine()); | |
cSide = Math.Sqrt((aSide * aSide) + (bSide * bSide)); | |
Console.WriteLine("the length of the hypotenuse will be {0:0.00}", cSide); | |
Console.ReadLine(); |