29 lines
742 B
C#
29 lines
742 B
C#
using System;
|
|
|
|
class DivideIt
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
try
|
|
{
|
|
Console.WriteLine("enter the first integer");
|
|
string temp = Console.ReadLine();
|
|
int i = Int32.Parse(temp);
|
|
Console.WriteLine("enter the second integer");
|
|
temp = Console.ReadLine();
|
|
int j = Int32.Parse(temp);
|
|
int k = i / j;
|
|
Console.WriteLine("{0} / {1} = {2}", i, j, k);
|
|
}
|
|
catch (FormatException e)
|
|
{
|
|
Console.WriteLine("format exception was thrown: {0}", e.Message);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine("exception was thrown: {0}", e.Message);
|
|
}
|
|
}
|
|
}
|
|
|