{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

IE 148 homework 4

IE 148 homework 4 - Tyler Fox IE 148 HW 4 Problem 1 5*9 A S...

This preview shows pages 1–6. Sign up to view the full content.

9 * 5 Tyler Fox IE 148 HW 4 Problem 1 A. S J 1 0 = S + 1 1 5 S = 1 + 4 4 Message box would show S as 12 S = 5 + 7 7 B. S = 0 For K = 1 to For M = 2 to 10 Step 2 steps total S = S + 1 Next M Next K 9*5 = Message box would show S as 45 MsgBox(S) C. S New S

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Tyler Fox IE 148 HW 4 0 S = 0 + 1 1 1 S = 1 + 1 2 2 S = 2 + 1 Message box would show S as 3 D. S J X X = 2 * J S = S + 4 * X J = J + J ^ 2 0 3 2 X = 2*3 S = 0 + 4*6 J = 3 + 3^2 24 12 6 X = 2*12 S = 24 + 4*24 J = 12 + 12^2 120 156 12 Message box would show S as 120 Problem 2 Sub myprog() Dim A(100) As Integer, i As Single, sum As Single, gm As Single
Tyler Fox IE 148 HW 4 Open "U: \DATA.DAT" For Input As 1 Do While Not EOF(1) i = i + 1 Input #1, A(i) sum = sum + A(i) Loop gm = sum ^ (1 / i) gm = Round(gm, 2) Close 1 MsgBox ("geometric mean= " & gm) End Sub

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Tyler Fox IE 148 HW 4 Problem 3 Sub myprog() Dim A(3 To 10, 1 To 20) As Single, Row As Integer, Column As Integer, sum As Single, Avg As Single, Percent(10, 20) As Single, n As Single, s As Single Open " \ \ files.engineering.iastate.edu \home\trfox \My Documents \IE 148\Widget2004.dat" For Input As 1 Open " \ \ files.engineering.iastate.edu \home\trfox \My Documents \IE 148\AVGandPERCENT"

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}