Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- let rec p (acc : bigint) (value : bigint) =
- if value = 0I
- then acc
- else p (acc + (value % 10I)) (value / 10I)
- [<EntryPoint>]
- let main argv =
- printf "Ввидте число "
- Console.ReadLine()
- |>(fun line -> bigint(Convert.ToInt32(line)))
- |>p 0I
- |>printfn "Сумма цифр в числе %A"
- 0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement