VB Operands for Arithmetic

# Thread: VB Operands for Arithmetic

1. Senior Member
Join Date
Dec 1969
Posts
182

## VB Operands for Arithmetic

&nbsp;<BR>If I use the + sign I get the value 49.03, but if I use the * I get the value 49, when it should result in 1.47. Why?<BR><BR> response.write (a1dollars+a2dollars+a3dollars+a4dollars + (a1percent+a2percent+a3percent+a4percent)/100) <BR><BR> response.write (a1dollars+a2dollars+a3dollars+a4dollars * (a1percent+a2percent+a3percent+a4percent)/100)

2. Senior Member
Join Date
Dec 1969
Posts
182

## Needed more parens for multiplication. Why?

Okay, so I needed more parens around the dollars.<BR><BR>response.write ((a1dollars+a2dollars+a3dollars+a4dollars) * (a1percent+a2percent+a3percent+a4percent)/100) <BR><BR><BR>Why will it add and subtract without the extra parens, but not mulitply or divide?

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Needed more parens for multiplication. Why?

Multiplication/Division has a higher precedence than Addition/Subtraction.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•