Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 2.38 KB | None | 0 0
  1. //Zadanie 1
  2.  
  3. //open System
  4.  
  5. //[<EntryPoint>]
  6. //let main argv =
  7. //    printfn "Podaj A"    
  8. //    let a = System.Console.ReadLine()|>int;
  9. //    printfn "Podaj B"
  10. //    let b = System.Console.ReadLine()|>int;
  11. //    let rec pot m n =  
  12. //     match n with
  13. //      |0 -> 1
  14. //      |_ -> m * (pot m (n-1));      
  15.    
  16.  
  17. //    printfn "%d^%d=%d" a b (pot a b);
  18. //    let x = System.Console.ReadLine();
  19. //    0 // return an integer exit code
  20.  
  21.  
  22.  
  23. //Zadanie    2
  24.  
  25. //open System
  26.  
  27. //[<EntryPoint>]
  28. //let main argv =
  29. //    printfn "Podaj A"    
  30. //    let a = System.Console.ReadLine()|>int;
  31. //    printfn "Podaj B"
  32. //    let b = System.Console.ReadLine()|>int;
  33. //    let rec sum m n =  
  34. //     match n with
  35. //      |1 -> m
  36. //      |_ -> (sum (m+1) (n-1)) + m;
  37.      
  38.      
  39.      
  40.      
  41.    
  42.  
  43. //    printfn "%d %d %d" a b (sum a b);
  44. //    let x = System.Console.ReadLine();
  45. //    0 // return an integer exit code
  46. //Zadanie 3
  47.  
  48. //open System
  49.  
  50. //[<EntryPoint>]
  51. //let main argv =
  52. //    printfn "Podaj A"    
  53. //    let a = System.Console.ReadLine();
  54. //    let rec tylkoMaleLitery (s:string)  =  
  55. //     if s.Length = 0 then true
  56. //     else System.Char.IsLower(s.[0])&&tylkoMaleLitery(s.Substring(1));
  57.      
  58.      
  59.      
  60.    
  61.  
  62. //    printfn "%b" (tylkoMaleLitery a);
  63. //    let x = System.Console.ReadLine();
  64. //    0 // return an integer exit code
  65.  
  66.  
  67. ////Zadanie 4
  68. //open System
  69.  
  70. //[<EntryPoint>]
  71. //let main argv =
  72. //    printfn "Podaj A"    
  73. //    let a = System.Console.ReadLine()|>int;
  74. //    printfn "Podaj B"
  75. //    let b = System.Console.ReadLine()|>int;
  76.    
  77. //    let rec mRn m n  =  
  78. //     match n with
  79. //      |0 -> mRn m 0
  80. //      |1 -> mRn m 1
  81. //      |_ -> m + m * (n-1);
  82.      
  83.      
  84.      
  85.    
  86.  
  87. //    printfn "%d*%d=%d" a b (mRn a b);
  88. //    let x = System.Console.ReadLine();
  89. //    0 // return an integer exit code
  90.  
  91. ////Zadanie 5
  92. open System
  93.  
  94. [<EntryPoint>]
  95. let main argv =
  96.     printfn "Podaj tekst"    
  97.     let tekst = System.Console.ReadLine();
  98.     printfn "Podaj znak"
  99.     let tekst = System.Console.ReadLine()|>char;
  100.     let wyst = 0;
  101.     let wystOdItego tekst wyst znak  =  
  102.      for i in 0 .. String.length tekst do
  103.       if tekst.[i] = znak then wyst = wyst + 1 else wyst = wyst;
  104.              
  105.      
  106.      
  107.    
  108.  
  109.     printfn "%d*%d=%d" a b (mRn a b);
  110.     let x = System.Console.ReadLine();
  111.     0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement