F# Recipe #1 – Display Odd Numbers between 0 and 100 in Console Window

Problem

You need to write a F# program to display odd numbers between 0 and 100 in the console window.

F# Program to display odd numbers between 0 and 100 in the Console Window.

open System
[<EntryPoint>]
let main argv = 
    let mutable sum = 0
    for index=0 to 100 do
        if index%2 <> 0 then 
            sum <- sum + index
    printfn "sum is %A" sum
    let ret = Console.ReadLine()
    0//

Output

sum is 2500