visual studio - Display numbers that are divisible by 7 (range 10-25). Calculate and display an average of the numbers that are not divisible by 7 -
so wrote code in visual basic. how can improved? not know how display numbers 14 , 21 in other way.
public class form1 private sub button1_click(sender object, e eventargs) handles button1.click dim counter byte = 0 dim accumulator short = 0 dim average single dim loopcounter byte loopcounter = 10 25 if loopcounter mod 7 <> 0 accumulator += loopcounter counter += 1 else label1.text = loopcounter & ", 14"\ end if next average = accumulator / counter label2.text = average end sub
end class
Comments
Post a Comment