Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.78 KB | None | 0 0
  1. // Learn more about F# at http://fsharp.org
  2. // See the 'F# Tutorial' project for more help.
  3. open System
  4.  
  5.  
  6. let rec srgeom iloczyn ilosc suma =
  7.     let w  = Convert.ToDouble(Console.ReadLine())
  8.     if w <> 0.0 then srgeom (iloczyn * w) (ilosc + 1) (suma + w )
  9.     else
  10.     if ilosc =0 then (Double.NaN, suma)
  11.     else (Math.Pow(iloczyn, 1.0/(float ilosc)),suma)
  12.  
  13. let rec rysuj i =
  14.     printf "*"
  15.     if i > 0 then rysuj (i-1)
  16.     else printfn ""
  17.  
  18. let rec choinka wiersze r =
  19.     if r < wiersze then choinka wiersze (r-1)
  20.     rysuj(r)
  21.  
  22. [<EntryPoint>]
  23. let main argv =
  24.     printfn "%A" argv
  25.     // printfn "%A" (srgeom 0.0 0 0.0)
  26.     printf "Podaj liczbe wierszy: "
  27.     let wiersze = Convert.ToInt32(Console.ReadLine())
  28.     choinka wiersze 0
  29.     0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement