Skip to content

Instantly share code, notes, and snippets.

@akobashikawa
Created December 13, 2017 22:42
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 akobashikawa/45988c5846dda4f2658919b8d0adb6c6 to your computer and use it in GitHub Desktop.
Save akobashikawa/45988c5846dda4f2658919b8d0adb6c6 to your computer and use it in GitHub Desktop.
.NET HelloWorld
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Your name?");
string name = Console.ReadLine();
Console.WriteLine("Your age?");
int age;
if (int.TryParse(Console.ReadLine(), out age))
Console.WriteLine("Hello " + name + ", and happy " + age + " years!");
else {
Console.WriteLine("Hello " + name + "! please check your input for age");
Environment.Exit(0);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment