Private Sub Command1_Click()
marks = InputBox("Enter obtained marks")
Select Case marks
Case Is < 33
MsgBox "Fail"
Case Is >= 33, Is <= 49
MsgBox "Third Division"
Case Is >= 50, Is <= 59
MsgBox "Second Division"
Case Is >= 60
MsgBox "First Division"
Case Else
MsgBox "Not a valid marks percentage"
End Select
End Sub
Posted by: Wasim Javed
Understand All about Windows 7 Tips and Tricks, Fashion,Technology, Sports, Games,Windows 8 ,Computer Science ,Essay ,Application and more useful content here, Simply to Read and Enjoy it.
Feed Headline Animator
WAP to find the factorial by using next loop statements.
Private Sub Command1_Click()
Dim f As Long, n As Long, i As Long
n = InputBox("Enter as integer", "Factorial")
f = 1
For i = n To 1 Step -1
f = f * i
Next
MsgBox ("Factorial of " & n & "is" & f)
End Sub
Posted by: Wasim Javed
Dim f As Long, n As Long, i As Long
n = InputBox("Enter as integer", "Factorial")
f = 1
For i = n To 1 Step -1
f = f * i
Next
MsgBox ("Factorial of " & n & "is" & f)
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
WAP to find sum of first ten even numbers.
Private Sub Command1_Click()
Dim r As Integer
Dim n As Integer
Dim s As Integer
s = 0
n = 1
Do
r = n Mod 2
If r = o Then s = s + n
n = n + 1
Loop While n <= 10
MsgBox ("Sum of first ten even number is " & s)
End Sub
Posted by: Wasim Javed
Dim r As Integer
Dim n As Integer
Dim s As Integer
s = 0
n = 1
Do
r = n Mod 2
If r = o Then s = s + n
n = n + 1
Loop While n <= 10
MsgBox ("Sum of first ten even number is " & s)
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
WAP to print first ten natural number on the screen.
Private Sub Command1_Click()
Dim a As Integer
n = 1
Do Until n > 10
Print n
n = n + 1
Loop
End Sub
Posted by: Wasim Javed
Dim a As Integer
n = 1
Do Until n > 10
Print n
n = n + 1
Loop
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
Write a program to find the days of week through select statement
Private Sub Command1_Click()
week = InputBox("Enter No of day")
Select Case week
Case 1
MsgBox "Monday"
Case 2
MsgBox "Tuesday"
Case 3
MsgBox "Wednesday"
Case 4
MsgBox "Thursday"
Case 5
MsgBox "Friday"
Case 6
MsgBox "Saturday"
Case 7
MsgBox "Sunday"
Case Else
MsgBox "Not a valid day number"
End Select
End Sub
Posted by: Wasim Javed
week = InputBox("Enter No of day")
Select Case week
Case 1
MsgBox "Monday"
Case 2
MsgBox "Tuesday"
Case 3
MsgBox "Wednesday"
Case 4
MsgBox "Thursday"
Case 5
MsgBox "Friday"
Case 6
MsgBox "Saturday"
Case 7
MsgBox "Sunday"
Case Else
MsgBox "Not a valid day number"
End Select
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
WAP to find factorial of a given number.
Private Sub Command1_Click()
Dim f As Long, n As Long
n = InputBox("enter as integer", "Factorial")
f = 1
Do While n > 1
f = f * n
n = n - 1
Loop
MsgBox ("Factorial of the integer is " & f)
End Sub
Posted by: Wasim Javed
Dim f As Long, n As Long
n = InputBox("enter as integer", "Factorial")
f = 1
Do While n > 1
f = f * n
n = n - 1
Loop
MsgBox ("Factorial of the integer is " & f)
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
WAP to print tables of a given number.
Private Sub Command1_Click()
Dim t As Integer
Dim n As Integer
t = InputBox("Enter number to print table")
Form1.Caption = "table of " & t
n = 1
Cls
While n <= 10
Print t, "X", n, "=", t * n
n = n + 1
Wend
End Sub
Posted by: Wasim Javed
Dim t As Integer
Dim n As Integer
t = InputBox("Enter number to print table")
Form1.Caption = "table of " & t
n = 1
Cls
While n <= 10
Print t, "X", n, "=", t * n
n = n + 1
Wend
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
WAP to find grade
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
a = InputBox("Enter first value", "first value")
b = InputBox("Enter second value", "second value")
c = InputBox("Enter third value", "third value")
d = InputBox("Enter fourth value", "fourth value")
e = InputBox("Enter fifth value", "fifth value")
If a < 70 Then
MsgBox ("Fail")
ElseIf a < 80 Then
MsgBox ("Grade=c")
ElseIf a < 90 Then
MsgBox ("Grade=b")
Else
MsgBox ("Grade=a")
End If
End Sub
Posted by: Wasim Javed
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
a = InputBox("Enter first value", "first value")
b = InputBox("Enter second value", "second value")
c = InputBox("Enter third value", "third value")
d = InputBox("Enter fourth value", "fourth value")
e = InputBox("Enter fifth value", "fifth value")
If a < 70 Then
MsgBox ("Fail")
ElseIf a < 80 Then
MsgBox ("Grade=c")
ElseIf a < 90 Then
MsgBox ("Grade=b")
Else
MsgBox ("Grade=a")
End If
End Sub
Posted by: Wasim Javed
Labels:
Visual Basic Programming
Subscribe to:
Posts (Atom)