Visual Basic Programming [Lesson 1 To Lesson 4]
1 of 1
Loops: Exercises
Author: Kasun Ranga Wijeweera
Email: krw19870829@gmail.com
Date: 2020 May 31
1)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a button to the form and program it according to the steps given below.
c) Generate integers from 1 to 10 using a While…End While statement.
d) Display the generated integers in message boxes.
2)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a button to the form and program it according to the steps given below.
c) Generate integers from 1 to 10 using a Do…Loop statement with While keyword.
d) Display the generated integers in message boxes.
3)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a button to the form and program it according to the steps given below.
c) Generate integers from 1 to 10 using a Do…Loop statement with Until keyword.
d) Display the generated integers in message boxes.
4)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form and name it as txtNum.
c) Add a button to the form and name it as btnPrime.
d) Change the Text property of the button to “Is Prime?”.
e) Program the button according to the steps given below.
f) The user is expected to enter an integer in the text box.
g) A prime number (or a prime) is an integer greater than 1 that has no positive divisors
other than 1 and itself.
h) The text “Yes” should be displayed in a message box if the integer entered in the text box
is a prime. Otherwise the text “No” should be displayed in a message box.

Loops in Visual Basic: Exercises

  • 1.
    Visual Basic Programming[Lesson 1 To Lesson 4] 1 of 1 Loops: Exercises Author: Kasun Ranga Wijeweera Email: krw19870829@gmail.com Date: 2020 May 31 1) a) Start a new Visual Basic Windows Forms Application project. b) Add a button to the form and program it according to the steps given below. c) Generate integers from 1 to 10 using a While…End While statement. d) Display the generated integers in message boxes. 2) a) Start a new Visual Basic Windows Forms Application project. b) Add a button to the form and program it according to the steps given below. c) Generate integers from 1 to 10 using a Do…Loop statement with While keyword. d) Display the generated integers in message boxes. 3) a) Start a new Visual Basic Windows Forms Application project. b) Add a button to the form and program it according to the steps given below. c) Generate integers from 1 to 10 using a Do…Loop statement with Until keyword. d) Display the generated integers in message boxes. 4) a) Start a new Visual Basic Windows Forms Application project. b) Add a text box to the form and name it as txtNum. c) Add a button to the form and name it as btnPrime. d) Change the Text property of the button to “Is Prime?”. e) Program the button according to the steps given below. f) The user is expected to enter an integer in the text box. g) A prime number (or a prime) is an integer greater than 1 that has no positive divisors other than 1 and itself. h) The text “Yes” should be displayed in a message box if the integer entered in the text box is a prime. Otherwise the text “No” should be displayed in a message box.