A simple program that will ask the user to give a number and then our program will compute the factorial value of the given number by our user. I am using Microsoft Access 2003 in developing this program.
I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.
Sample Program Output
Program Listing
Option Compare Database
Function Factorial(Num As Integer)
Dim i As Integer, answer As Double
answer = 1
For i = 1 To Num
answer = answer * i
Next i
Factorial = answer
End Function
Private Sub Command12_Enter()
Me.txtvalue = ""
Me.Label9.Caption = ""
Me.txtvalue.SetFocus
End Sub
Private Sub Command13_Click()
Dim Sure As Integer
Sure = MsgBox("Are you sure?", vbOKCancel)
If Sure = 1 Then
DoCmd.Quit
Else
DoCmd.OpenForm "frmFactorial"
Me.txtvalue.SetFocus
End If
End Sub
Private Sub Command7_Click()
Dim val_solve As Integer
If Len(Trim(Me.txtvalue) & vbNullString) = 0 Then
MsgBox "Kindly give a number", vbInformation
Me.txtvalue.SetFocus
Exit Sub
End If
Label9.Visible = True
val_solve = Factorial(Val(Me.txtvalue))
Label9.Caption = "Factorial value is " + Str(val_solve) + "."
End Sub
No comments:
Post a Comment