F# program to Divide two numbers using Functions
Program
open System
let divide a b = try
let mutable c = 0
c <- a/b;
Console.WriteLine("Quotient of two numbers is:\t{0}" , c); 1
with
| :? System.DivideByZeroException as ex -> Console.WriteLine(ex.Message); 0
Console.Write("Enter the first number:\t")
let first = Int32.Parse(Console.ReadLine())
Console.Write("Enter the second number:\t")
let second = Int32.Parse(Console.ReadLine())
// Function divide is called
let result = divide first second
Output 1
Enter the first number: 34
Enter the second number: 4
Quotient of two numbers is: 8
Output 2
Enter the first number: 56
Enter the second number: 0
Attempted to divide by zero