Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Program1 =
- open System
- let read() =
- printf "Introduceti dimensiunea: "
- int (Console.ReadLine())
- let mainP1() =
- let a = read()
- let b = read()
- let c = read()
- let validare a b c = if (a<b+c) && (b<a+c) && (c<a+b) && (a>0) && (b>0) && (c>0) then "Triunghiul este valid" else "Triunghiul nu este valid"
- let message = validare a b c
- printfn "%s" message
- // ====================================================================
- module Program2 =
- let and' a b = a && b
- let or' a b = a || b
- let not' a = not a
- let xor' a b = and' (or' a b) (not'(and' a b))
- let printLine f a b =
- printfn "%A\t%A\t%A" a b (f a b)
- let printTable f =
- printLine f false false
- printLine f false true
- printLine f true false
- printLine f true true
- let mainP2() =
- printTable xor'
- // ====================================================================
- module Program3 =
- let rec sqrtRecursive b x =
- if abs((b*b)-x) > 1e-12 then sqrtRecursive (((x/b)+b)/2.0) x
- else b
- let sqrt' x =
- if x < 0.0 then nan
- else sqrtRecursive x x
- let result = sqrt' 9.0
- let mainP3() =
- printfn "%f" result
- // ====================================================================
- [<EntryPoint>]
- let main argv =
- Program1.mainP1()
- Program2.mainP2()
- Program3.mainP3()
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement