Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.94 KB | None | 0 0
  1. let wypisz (x, y) =
  2.      match (x, y) with
  3.      | x, y -> printf "Suma wynosi %f. Srednia geometryczna wynosi %f" x y
  4.  
  5. let rec drukuj_pom ile znak =
  6.     if ile > 0 then
  7.         printf "%c" znak
  8.         drukuj_pom (ile - 1) znak
  9.     else
  10.         if znak = ' ' then
  11.             printf ""
  12.         else
  13.             printfn ""
  14.  
  15.  
  16.  
  17. let rec choinka metoda wiersze wiersz =
  18.     if metoda = 1 then
  19.         if wiersze > 0 then
  20.             drukuj_pom wiersz '*'
  21.             choinka 1 (wiersze - 1) (wiersz + 1)
  22.         else printfn ""
  23.     else
  24.         if metoda = 2 then
  25.             if wiersze > 0 then
  26.                 drukuj_pom (wiersze - wiersz) ' '
  27.                 drukuj_pom (wiersz * 2 - 1) '*'
  28.                 choinka 2 (wiersze - 1) (wiersz + 1)
  29.             else printfn ""
  30.         else
  31.             if wiersze > 0 then
  32.                 drukuj_pom wiersz '*'
  33.                 choinka 1 (wiersze - 1) (wiersz + 1)
  34.             else printfn ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement