|
| ||||||||||
| Tags: programming language, round a number, scripting language, software coding, vb script, vbscript programs |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Round a number in VB-Script
|
|
#2
| ||||
| ||||
| VBScript Program to round up a number
I also had hard time to code the program to round a number in VBScript programming. But then I learnt about the in-built function of VBScript known as the Round() function. This is the function used to round a number in VBScript. Here is a program using VBScript to round up a number: HTML Code: <html> <body> <script type="text/vbscript"> a = 37.273095 b = 14.82649 Round Up Value:document.write(Round(a)) Round Up Value:document.write("<br /><br/>") Round Up Value:document.write(Round(b)) </script> </body> </html> |
|
#3
| ||||
| ||||
| Random Numbers between 0 to 50
The following program will help you to generate Random number in the range of 0 -50. HTML Code: <html> <body> <script type="text/vbscript"> Randomize() temp=Int(50 * Rnd()) document.write("A random number: <b>" & temp & "</b>") </script> </body> </html> |
|
#4
| ||||
| ||||
| Rnd( ) to get Random numbers
To get a random number generated in VBScript we can make use of the Rnd(). This Rnd() function will provide you with pseudo-random number. This random number generated by Rnd() function is a value which is positive but cannot be greater the one. We can use this pseudo-random number and multiple with another value to get any pseudo-random number that is less then the provided value. |
|
#5
| |||
| |||
| Replacing String HTML Code: <Html> <Body> <Head> <Title>Replacing String</title> </Head> <Script type="text/vbscript"> strng="Replace this" document.write(Replace(strng, "Replace", "Swap")) </Script> </Body> </Html> |
|
#6
| ||||
| ||||
| Returning Random Number
I had an assignment that asked for a program in VBscript that would return a random number. Here is how I coded the program: HTML Code: <Html> <body> <script type="text/vbscript"> Randomize() Random Number document.write(Rnd()) </script> </body> </Html> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Round a number in VB-Script" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another round of waterblocks on i7 | Galimberti | Overclocking & Computer Modification | 5 | 01-09-2010 04:37 AM |
| How to use QQ round blocking software | Kalanidhi | Technology & Internet | 4 | 07-03-2010 02:46 AM |
| Round up program for C# | Damien25 | Software Development | 4 | 22-01-2010 09:19 PM |
| Need help on ROUND function in excel | Cade | Windows Software | 5 | 26-12-2009 07:29 PM |
| Round Portable DVD Player | AdamT | Portable Devices | 0 | 12-07-2008 12:12 PM |