Created
December 13, 2017 22:42
-
-
Save akobashikawa/45988c5846dda4f2658919b8d0adb6c6 to your computer and use it in GitHub Desktop.
.NET HelloWorld
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
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