F# program to check the given number is positive or negative
Program.fs
open System

Console.Write("Enter the number ")
let n = int32(Console.ReadLine())

if n < 0 then printfn "%i is a negative number" n
elif n > 0 then printfn "%i is a positive number" n
else printfn "Given number is Zero"
Output
kodingwindow@kw:~/fsharp$ dotnet run
Enter the number -0
Given number is Zero

kodingwindow@kw:~/fsharp$ dotnet run
Enter the number -5
-5 is a negative number
kodingwindow@kw:~$ 
Advertisement