In Visual Basic code the display buttons click event procedu

In Visual Basic, code the display buttons 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 control using the For...Next statement.

Odd Squares Display Exit

Solution

Answer :-

look, for/next loop from that syntax .. 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 :D

In Visual Basic, code the display buttons click event procedure so that it displays the squares of the odd integers from 1 through 9 in the squaresLabel. Displa

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site