F# program to calculate the area and circumference of a circle
Program.fs
open System

printfn "———————————————————————————————————————————"
printfn "Program to calculate the area and circumference of a circle"
printfn "———————————————————————————————————————————"
printf "Enter the radius of a circle "
let r = float(Console.ReadLine())
printfn "The area of a circle is %f " (Math.PI * r * r)
printfn "The circumference of a circle is %f " (float(2) * Math.PI * r)
printfn "———————————————————————————————————————————"
Output
kodingwindow@kw:~/fsharp$ dotnet run
———————————————————————————————————————————
Program to calculate the area and circumference of a circle
———————————————————————————————————————————
Enter the radius of a circle 10
The area of a circle is 314.159265 
The circumference of a circle is 62.831853 
———————————————————————————————————————————
kodingwindow@kw:~$ 
Advertisement