CSharp examples for Language Basics:int
Integer division without exception handling.
using System;/*w ww. j a v a2s. c o m*/ class MainClass { static void Main() { // get numerator Console.Write("Please enter an integer numerator: "); var numerator = int.Parse(Console.ReadLine()); var denominator = 0; // divide the two integers, then display the result var result = numerator / denominator; Console.WriteLine($"\nResult: {numerator} / {denominator} = {result}"); } }