473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Question with math loop in vb.net

Greetings All,

I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801
Num / 2
Loop
Num / 11

I can get most of it but I'm having problems with the syntax and adding the "And" statement.
Help please.

TIA

Nov 21 '05 #1
5 1224
Rob
The While phrase should be:
While Num < 0.0998 And Num > .0801

HTH

Rob
"m@simple.net" wrote:
Greetings All,

I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801
Num / 2
Loop
Num / 11

I can get most of it but I'm having problems with the syntax and adding the "And" statement.
Help please.

TIA

Nov 21 '05 #2
Try:

While Num < 0.0998 And Num > 0.0801

Num = Num / 2

End While

Num = Num / 11
--

Carlos J. Quintero (Visual Developer - .NET MVP)

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
<m@simple.net> escribió en el mensaje
news:UV********************@bignews4.bellsouth.net ...
Greetings All,

I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801
Num / 2
Loop
Num / 11

I can get most of it but I'm having problems with the syntax and adding the "And" statement. Help please.

TIA

Nov 21 '05 #3
<m@simple.net> schrieb:
I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801


\\\
While Num < 0.0998 AndAlso Num > 0.0801
...
End While
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #4

<m@simple.net> wrote

I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801
Num / 2
Loop
Num / 11

I can get most of it but I'm having problems with the syntax and adding the "And" statement.

Always be as explicit as you can, (also be sure option Explicit is On)

While (Num < .0998) And (Num > .0801)
....
The comparison operators need values on both sides and the use
of parentheses avoids any ambiguity in what the evaluation order
should be.

Ex

2 * 5 + 7 = ?

(2 * 5) + 7 = 17
2 * (5 + 7) = 24

In the top (?) example the programmer has relied on VB to do the
right thing. Don't do that! Use parentheses to let everyone know
what the correct order of evaluation should be. The same goes
for your comparisons....

HTH
LFS
Nov 21 '05 #5
In addition to the other comments you can do:
While Num < 0.0998 And Num > .0801
Num /= 2
Loop
Num /= 11
Hope this helps
Jay

<m@simple.net> wrote in message
news:UV********************@bignews4.bellsouth.net ... Greetings All,

I have a question on a math loop and programming it in VB.net
Here's the logic:

While Num < 0.0998 And > .0801
Num / 2
Loop
Num / 11

I can get most of it but I'm having problems with the syntax and adding
the "And" statement.
Help please.

TIA

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: da Vinci | last post by:
Hello. First off, I am not sure of the exact jargon used, so I will ask a question regarding it. Then on to my other question. When you use things like cout and cin from the iostream header...
5
by: R. Russell Kinter | last post by:
Hi all, First of all I am fairly new to javascript. Most of my experience has been with its subset vrmlscript, so have mercy. The following script works in I.E. 5.5, but hangs up in Netscape 4.8...
38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
6
by: johny smith | last post by:
I was defining one of my own math functions for sin. So I thought I would create a unique name space. Then use that namespace in my program to call my custom sin math function. That way I was...
1
by: Rhino | last post by:
Given a loop like this: for (int ix=0; ix<myArray.length; ix++) { System.out.println(ix); } or especially this: for (int ix=0; ix<Math.sqrt(shoeSize)*hairlength/(IQ); ix++) {...
2
by: ben | last post by:
hello, i'm following an algorithm book and am stuck on an early excersise in it, not because of the c programming side of it or even the algorithm side of it, i don't think, but because of maths....
15
by: Morgan Cheng | last post by:
Hi, I am writing a program that will take a lot of Math.Cos & Math.Sin operation. I am afraid this will be source of performance impact. Anybody knows how Math.cos & Math.Sin is implemented?...
5
by: trillianx | last post by:
I know there has been lot of discussion on Prime numbers program but I have very specific question. Here is my program: # Find the prime numbers # This is a user input program that lets you...
5
by: Jon Slaughter | last post by:
I wrote a routine to replace Math's Exp method but it turns out to be almost 2x slower ;/ (well, actually its about 1.5x in release) I'm essentially using a lookup table and interpolate between...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.