Skip to content

Instantly share code, notes, and snippets.

//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());
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;
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)
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;
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 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, 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;
//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;
@RMcGee
RMcGee / Modularity
Last active December 24, 2015 08:39
static void Main(string[] args)
{
Char menuItem;
Console.WriteLine("Welcome to ze calculator");
menuItem = GetMenuItem();
while (menuItem != 'X')
{
ProcessMenuItem(menuItem);
menuItem = GetMenuItem();
}// while
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];