I want to learn a bit of OCaml, just to get an idea of ββa programming language other than C ++ and Java. I will be very grateful if you help me with the following program: basically the user enters a positive integer. The sum of all integers from N to 0 is displayed.
Obviously, you are creating an integer N so that the user enters its value. Create a sum variable of type int . Have a for loop that will add N to sum , and then decrease the value of N by one. The loop will work until N greater than 1. I have no idea how to do this in the OCaml syntax.
Any help would be greatly appreciated.
source share