Library tutorials & articles
Mathematical Functions
Roots
To find the square root of a number in Visual Basic, use the Sqr function. It's syntax is very simple:
Sqr(9) ' returns 3
One function that might not be quite so obvious is how to calculate the nth root of a number. To do this, all you need to do is use the following syntax:
nNumber ^ (1 / nRoot)
So, if you wanted to find the cubed root of 8 (ie root 3), all you need to do is
8 ^ (1 / 3)
and, if you wanted to find root 4 of 12, use
12 ^ (1 / 4)
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Comments
Leave a comment
Sign in or Join us (it's free).