Advertisement
noctual

Задание 1

Jun 13th, 2021
1,700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.38 KB | None | 0 0
  1. open System
  2.  
  3. let rec p (acc : bigint) (value : bigint) =
  4.     if value = 0I
  5.     then acc
  6.     else p (acc + (value % 10I)) (value / 10I)
  7.  
  8. [<EntryPoint>]
  9. let main argv =
  10.     printf "Ввидте число "
  11.     Console.ReadLine()
  12.     |>(fun line -> bigint(Convert.ToInt32(line)))
  13.     |>p 0I
  14.     |>printfn "Сумма цифр в числе %A"
  15.     0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement