| | |
Is this correct
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 21
Reputation:
Solved Threads: 0
Write the pseudocode for a program that uses a single while loop to print the numbers from 20 to 25 and from 40 to 45. your loop will have at least one nested "if" statement that will determine when the numbers should be printed.
VB.NET Syntax (Toggle Plain Text)
If X >= 20 Then If X <= 25 Then Print X End If If X>=40 Then If X <=45 Then Print X End If
Last edited by Tekmaven; Jul 22nd, 2008 at 7:39 pm. Reason: Code tags
Hi,
Your code is doing well.
Just in case, I have added the while loop in yours:
Or, you can do this:
Your code is doing well.
Just in case, I have added the while loop in yours:
VBNET Syntax (Toggle Plain Text)
Dim x As Integer Do While x <= 45 If x >= 20 Then If x <= 25 Then Debug.Print(x) End If If x >= 40 Then If x <= 45 Then Debug.Print(x) End If x = x + 1 Loop
Or, you can do this:
VBNET Syntax (Toggle Plain Text)
Dim x As Integer = 20 Do While x <= 45 If (x >= 20 And x <= 25) Or (x >= 40 And x <= 45) Then Debug.Print(x) End If x = x + 1 Loop
-- Martín
•
•
Join Date: Jul 2008
Posts: 21
Reputation:
Solved Threads: 0
So here's the question. I need to write the pseudocode for a program that uses a single while...loop to print the numbers from 20 to 25 and from 40 to 45. Your loop will have at least one nested "if" statement that will determine when the numbers should be printed.
Here's what I came up with.
Here's what I came up with.
VB.NET Syntax (Toggle Plain Text)
If X > = 20 Then If X < = 25 Then Print X End If If X > =40 Then If X < =45 Then Print X End If
Last edited by Tekmaven; Jul 22nd, 2008 at 7:42 pm. Reason: Code tags
Well...
That is what I've answered...
Your code have *at least* one nested "If". Actually, yours has four "If" statements.
If you need the pseudo-code, you can write:
which, isn't too much different from the actual VB.Net code...
That is what I've answered...
Your code have *at least* one nested "If". Actually, yours has four "If" statements.
If you need the pseudo-code, you can write:
VB.NET Syntax (Toggle Plain Text)
X = 0 WHILE X <= 45 IF (X >= 20 AND X <= 25) OR (X >= 40 AND X <= 45) PRINT X END IF X = X + 1 END WHILE
Last edited by dmf1978; Jul 22nd, 2008 at 7:38 pm.
-- Martín
•
•
Join Date: Jul 2008
Posts: 21
Reputation:
Solved Threads: 0
Hey I was wondering if this is correct or not. I need to read each record from the inventory database. Print a price tag for each item in inventory. Count & print the total number of tags printed. Sum and print the total retail value of the inventory in the store.
Read the first record
While not eof
Print fldItemnumber , fldDescription , fldQuantityonhand , fldRetailPrice
ItemCount = ItemCount +1
Totalretailvalue = (fldQuantity * fldRetailprice )
Read next record
Loop
Print “Retail price : “ & ItemCount
Print “Value of Inventory = “ & Totalretaivalue
Read the first record
While not eof
Print fldItemnumber , fldDescription , fldQuantityonhand , fldRetailPrice
ItemCount = ItemCount +1
Totalretailvalue = (fldQuantity * fldRetailprice )
Read next record
Loop
Print “Retail price : “ & ItemCount
Print “Value of Inventory = “ & Totalretaivalue
![]() |
Similar Threads
- database won't give correct permissions (MS SQL)
- Help function not returning correct value (C++)
- Returning a correct python list (Python)
- help me to correct this part of my program (C++)
- I cant correct these two errors (C++)
- correct errors in this program (C)
- code repeatedly 2 ask user 4 a password until correct (=Java) but cant c wots wrong. (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Delete From String array
- Next Thread: Code
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center checkbox click client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function html images input internet lib listview map mobile module msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read regex remove right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode xml year





