Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- /*
- from Lesson 4 of C# console programming tutorial series at following URL:
- http://williammillerservices.com/windows-c-console-programming/
- demonstrates potential run-time error in that user may fail to input
- a value that is parseable to an integer
- GitHub gist -> https://gist.github.com/kyrathasoft/2bc097e9e9a465f7d4388e46ed8798cb
- Pastebin.com -> https://pastebin.com/7uPxzcKG
- */
- namespace MyNamespace {
- class MyClass {
- static void Main(){
- Console.Write("Please enter an integer: ");
- string sNum = Console.ReadLine();
- int iNum = Int32.Parse(sNum);
- Console.WriteLine("You entered: {0}", iNum.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement