Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write a program, which reads an input from the console and prints "It is a number." if itβs a number. If it is not write "Invalid input!"
- using System;
- namespace _12._Number_Checker
- {
- class NumberChek
- {
- static void Main(string[] args)
- {
- //var input = Console.ReadLine();
- try
- {
- var input = int.Parse(Console.ReadLine());
- Console.WriteLine("It is a number.");
- }
- catch (Exception)
- {
- Console.WriteLine("Invalid input!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement