Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.
-
Upload
scot-weaver -
Category
Documents
-
view
241 -
download
0
Transcript of Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.
![Page 1: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/1.jpg)
Chapter six exercises
![Page 2: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/2.jpg)
6.1
![Page 3: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/3.jpg)
1. 17
2. 0 1000
1 1100
2
![Page 4: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/4.jpg)
![Page 5: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/5.jpg)
3. You are a super programmer!
![Page 6: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/6.jpg)
![Page 7: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/7.jpg)
7. The value of q keeps growing until the program crashes when the value exceeds the upper limit for a variable of the type Single.
8. Program never stops. The line n = 1 should appear before the Do loop.
![Page 8: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/8.jpg)
![Page 9: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/9.jpg)
11. While num >= 7
12. While nom <> "Bob"
13. Until response <> "Y"
14. Until total <> 10
15. Until nom = ""
16. While balance < 100
17. Until (a <= 1) Or (a >= 3)
18. While (ans <> "") And (n <> 0)
19. While n = 0
20. Until (ans <> "Y") Or (n >= 7)
![Page 10: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/10.jpg)
![Page 11: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/11.jpg)
![Page 12: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/12.jpg)
Private Sub cmdDisplayConvTable_Click() Dim celsius As Single picTempTable.Cls picTempTable.Print "Celsius"; Tab(10); "Fahrenheit" celsius = -40 Do While celsius <= 40 picTempTable.Print celsius; Tab(10); (9 / 5) * celsius + 32 celsius = celsius + 5 LoopEnd Sub
![Page 13: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/13.jpg)
![Page 14: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/14.jpg)
![Page 15: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/15.jpg)
Private Sub cmdFindPrimeFactors_Click() Dim n As Integer, f As Integer 'Prime factorization picFactors.Cls n = Val(InputBox("Enter an integer greater than 1:")) picFactors.Print "The prime factors of"; n; "are:" f = 2 Do While n > 1 If (n Mod f) <> 0 Then 'Or If Int(n/f) <> n/f Then f = f + 1 Else picFactors.Print f; n = n / f End If LoopEnd Sub
![Page 16: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/16.jpg)
6.2
![Page 17: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/17.jpg)
![Page 18: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/18.jpg)
![Page 19: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/19.jpg)
![Page 20: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/20.jpg)
1. 13 2. Roxie 3. pie
Velma cake
melon
4. Chicago 8.8
New York 20.1
![Page 21: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/21.jpg)
6.3
![Page 22: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/22.jpg)
1. Pass # 1
Pass # 2
Pass # 3
Pass # 4
2. 6 8 10 12
3. 2 4 6 8 Who do we appreciate?
![Page 23: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/23.jpg)
![Page 24: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/24.jpg)
8. Average = 90
![Page 25: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/25.jpg)
![Page 26: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/26.jpg)
17. Private Sub cmdDisplay_Click() Dim num As Integer For num = 1 To 10 Step 2 picOutput.Print num Next num End Sub18. Private Sub cmdDisplay_Click() Dim num As Integer For num = 1 To 4 picOutput.Print "hello" Next num End Sub
![Page 27: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/27.jpg)
19.Private Sub cmdDisplay_Click() Dim i As Integer 'Display a row of 10 stars picOutput.Cls For i = 1 To 10 picOutput.Print "*"; Next iEnd Sub
20.Private Sub cmdDisplay_Click() Dim i As Integer, stars As Integer 'Display a row of stars picOutput.Cls stars = Val(InputBox("Row length (1-20) : ")) For i = 1 To stars picOutput.Print "*"; Next iEnd Sub
![Page 28: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/28.jpg)
21.
Private Sub cmdDisplay_Click() Dim i As Integer, j As Integer 'Display 10 x 10 array of stars picOutput.Cls For i = 1 To 10 For j = 1 To 10 picOutput.Print "*"; Next j picOutput.Print Next iEnd Sub
![Page 29: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/29.jpg)
![Page 30: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/30.jpg)
35.Private Sub cmdDraw_Click() Dim stars As Integer, i As Integer picOutput.Cls picOutput.Font.Name = "Courier New" stars = Val(InputBox("Number of stars?")) For i = 1 To stars
picOutput.Print "*"; Next i picOutput.Print For i = 1 To stars - 2
picOutput.Print "*"; For j = 1 To stars - 2 picOutput.Print " "; Next j picOutput.Print "*"
Next i For i = 1 To stars
picOutput.Print "*"; Next i End Sub
![Page 31: Chapter six exercises. 6.1 1. 17 2. 0 1000 1 1100 2.](https://reader036.fdocuments.net/reader036/viewer/2022062322/5697c0101a28abf838ccb231/html5/thumbnails/31.jpg)
36.Private Sub cmdDraw_Click() Dim stars As Integer, topSize As Integer 'Draw a triangle picOutput.Cls picOutput.Font.Name = "Courier New" topSize = Val(InputBox("Enter an odd number:")) For stars = topSize To 1 Step -2 For i = 1 To stars picOutput.Print "*"; Next i picOutput.Print Next starsEnd Sub