Write an event procedure to collect an integer from the user and find out whether the given integer is an odd or an even one. Design a splash screen for this application. Use appropriate controls on the form.
Compare this program with the JAVA program.
Compare this program with the JAVA program.
Odd or Even checking in JAVA
A) Program Design :
(B) Property(Controls Used) :
- 2 Labels - Captions are Enter an integer number and Result :
- One Command Button - Caption is Check
- One Text Box
(C) Attaching Code to the Object :
(Splash Screen Code is not given)
Private Sub Command1_Click() Dim num As Integer num = Val(Text1.Text) If num Mod 2 = 0 Then Label2.Caption = "Result : The number is even" Else Label2.Caption = "Result : The number is odd" End If End Sub |
- ====================================================================
===========================================================
No comments:
Post a Comment