cheat sheet test 1

# cheat sheet test 1 - Option Explicit Sub HWset31() 'Program...

This preview shows page 1. Sign up to view the full content.

Option Explicit Sub HWset31() 'Program to convert degrees Fahrenheit to degrees Celsius, Rankine, and Kelvin Dim x As Single, y As Single, z As Single, A As Single Open ("C:\Documents and Settings\output values.txt") For Output As 1 Print #1, "F", "C", Print #1, "__", "__", For x = 30 To 210 Step 20 y = (5 / 9) * (x - 32) Print #1, x, y Next x Print #1, "F", "R" Print #1, "__", "__", For x = 30 To 210 Step 20 z = x + 459.67 Print #1, x, z Next x Print #1, "F", "K" Print #1, "__", "__", For x = 30 To 210 Step 20 A = (5 / 9) * (x - 32) + 273.15 Print #1, x, A Next x Close End Sub Option Explicit Sub HWset32() 'Program to add up integers to n Dim n As Single, sum As Single, i As Integer n = InputBox("Input the value for n. Must be a positive number, equal to or greater than three") sum = 0 Do If (n < 3) Then n = InputBox("Please re-enter the value") Else: Exit Do End If Loop For i = 1 To n Step 2 sum = sum + i Next i If (n / 2 = n \ 2) Then sum = sum + n End If MsgBox ("The sum of the odd numbers from one to
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/26/2008 for the course ENGR 160 taught by Professor Sengupta during the Fall '07 term at Iowa State.

Ask a homework question - tutors are online