Code the Display buttons Click event procedure so that it di

Code the Display button\'s Click event procedure so that it displays the squares of the odd integers from 1 through 9 in the squaresLabel. Display each square on a separate line in the the control using the For...Next statement. It must use a \"For...next statement\".

Solution

for <variable> = <start> to <end> step <numbers added> so you can do that by for i as integer = 1 to 9

step 2 label1.text &= i^2 & vbnewline next i from this code you are counting closed interval from 1 to 9

and adding 2 for each loop not 1 (if you removed step 2 word it will count by default +1) and label1.text

&= i^2 is the same label1.text = label1.text & i^2 (i power 2) .. vbnewline I guess it is obvious to enter

new line

Code the Display button\'s Click event procedure so that it displays the squares of the odd integers from 1 through 9 in the squaresLabel. Display each square o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site