adsense


Thursday, 5 November 2015

VB SCRIPT OPERATORS PAGE 4

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button




VB SCRIPT OPERATORS





vb script  Operator 
Let’s take an expression 4 + 5 is equal to 9. Here, 4 and 5 are
 called operands and + is called the operator. VBScript language
 supports following types of operators: 

• Arithmetic Operators 

 

• Comparison Operators 

 

• Logical (or Relational) Operators 

 

• Concatenation Operators 

The Arithmetic Operators 
VBScript supports the following arithmetic operators: 
Assume variable A holds 5 and variable B holds 10, then: 


Operator 	Description                              Example 
+ 	Adds two operands 	                         A + B will give 15 
- 	Subtracts second operand from the first 	 A - B will give -5 
* 	Multiply both operands 	                         A * B will give 50 
/ 	Divide numerator by denominator  	         B / A will give 2 
% 	Modulus Operator and remainder 
         of after an integer division 	                 B MOD A will give 0 
^ 	Exponentiation Operator 	                 B ^ A will give 100000 


Example 
Try the following example to understand all the arithmetic operators available in VBScript: 
<!DOCTYPE html> 
<html> 
<body> 
<script language="vbscript" type="text/vbscript"> 
   Dim a : a = 5 
   Dim b : b = 10 
   Dim c 
 
   c = a+b 
   Document.write ("Addition Result is " &c) 
   Document.write ("<br></br>")    'Inserting a Line Break for readability 
   c = a-b 
   Document.write ("Subtraction Result is " &c) 
   Document.write ("<br></br>")   'Inserting a Line Break for readability 
   c = a*b 
   Document.write ("Multiplication Result is " &c) 
   Document.write ("<br></br>") 
   c = b/a 
   Document.write ("Division Result is " &c) 
   Document.write ("<br></br>") 
   c = b MOD a 
   Document.write ("Modulus Result is " &c) 
   Document.write ("<br></br>") 
   c = b^a 
   Document.write ("Exponentiation Result is " &c) 
   Document.write ("<br></br>") 
</script> 
</body> 
</html> 
When you save it as .html and execute it in Internet
 Explorer, then the above script will produce the following result: 
Addition Result is 15 
Subtraction 

Result is -5 
Multiplication Result is 50 
Division Result is 2 
Modulus Result is 0 
Exponentiation Result is 100000 







No comments: