Mathematical functions are very useful and important in programming because very often we need to deal with mathematical concepts in programming such as chance and probability, variables, mathematical logics, arithematic calculations, coordinates system, time intervals and more. Some of the common mathematical functions in Visual Basic are Rnd, Sqr, Int, Abs, Exp, Log, Sin, Cos, Tan , Atn, Fix and Round.
For example, Rnd is very useful when we deal with the concept of chance and probability. The Rnd function returns a random number between 0 and 1. In Example 1. Whenever you run the program, you will get an output of 10 random numbers between 0 and 1.
Example 1:
Private Sub Form_Activate
For x=1 to 10
Print Rnd
Next x
End Sub
For more info on Mathematical Functions, please refer to
http://www.vbtutor.net/lesson11.html
No comments:
Post a Comment