Skip to content

Instantly share code, notes, and snippets.

@snotskie
Created February 22, 2018 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snotskie/8532a02779512c2618ebc5cdc134e353 to your computer and use it in GitHub Desktop.
Save snotskie/8532a02779512c2618ebc5cdc134e353 to your computer and use it in GitHub Desktop.
My Answer for CIT 143 Lab 2, Part 3
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
// 1. Ask for their age
Console.WriteLine("How old are you?");
int age = Convert.ToInt32(Console.ReadLine());
// 2. Little Child
if (age < 4)
{
Console.WriteLine("What is your name?");
string name = Console.ReadLine();
Console.WriteLine("Let's go find your mommy, {0}.", name);
}
// 3. Medium-Sized Child
else if (age < 12)
{
Console.WriteLine("What is your favorite TV show?");
string tv = Console.ReadLine();
Console.WriteLine("Oh, I like {0} too!", tv);
}
// 4. Teenager
else if (age < 18)
{
Console.WriteLine("What is your favorite number?");
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Well, I like {0} better.", num+1);
}
// 5. Grown-Up
else
{
Console.WriteLine("Please remember to file your taxes on time.");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment