Skip to content

Instantly share code, notes, and snippets.

//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;
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;
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;
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;
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;
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)
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;
//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());
//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());
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();