View Single Post
03-05-2007, 07:52 PM
#2
Jack Morrison is offline Jack Morrison
Jack Morrison's Avatar
Status: Member
Join date: Dec 2005
Location: Ontario, Canada
Expertise:
Software:
 
Posts: 264
iTrader: 0 / 0%
 

Jack Morrison is on a distinguished road

Send a message via AIM to Jack Morrison Send a message via MSN to Jack Morrison Send a message via Yahoo to Jack Morrison Send a message via Skype™ to Jack Morrison

  Old

This is what I have for Question 2 - I feel it could be greatly improved though :/ - I still also have no way to check for all 4 digit numbers that do this.

Code:
Option Explicit
'Written By Jack Morrison

Sub JMA3Q2()
Dim N0 As Integer
Dim N1 As Integer
Dim N2 As Integer
Dim Total As Integer
Dim Ftotal As Integer
Dim Success As Boolean

N0 = InputBox("Enter Your 4 Digit Number", "Magic Number Calculator")
N1 = InputBox("Enter the first 2 digits of the number", "Magic Number Calculator")
N2 = InputBox("Enter the second 2 digits of the number", "Magic Number Calculator")
Total = N1 + N2
Ftotal = Total ^ 2

If Ftotal = N0 Then
Success = True
Else
Success = False
End If

If Success = True Then
MsgBox ("This number is a magic number: " & N0)
ElseIf Success = False Then
MsgBox ("This Number is not a Magic Number: " & N0)
End If


End Sub