Challenge:
Given the page:
BinaryChallenge.asp
You may write any type of code you wish inside the ChallengeFunction Area without changing any of the code outside of it. The challenge here is to not only finish the ChallengeFunction, but to do it in the least number of lines possible.
-Tarwn "Customer Support is an art not a service" - marketing saying
"So are most other forms of torture" - programmers response
(The Wiz Biz - Rick Cook)
Given the page:
BinaryChallenge.asp
Code:
<%
Option Explicit
%>
<html>
<body>
<form name="frmNumber" action="BinaryChallenge.asp" method="POST">
This page will tell you if the sum of the digits in a binary representation of your number is even or odd.<br>
For example:
<table>
<tr>
<td>Your Entry</td>
<td>Binary Representation</td>
<td>Total Of Digits</td>
<td>Even/Odd</td>
</tr>
<tr>
<td>5</td>
<td>101</td>
<td>2</td>
<td>Even</td>
</tr>
<tr>
<td>10</td>
<td>1010</td>
<td>2</td>
<td>Even</td>
</tr>
<tr>
<td>14</td>
<td>1110</td>
<td>3</td>
<td>Odd</td>
</tr>
</table>
Enter a number: <input type="text" name="txtUserEntry"><br>
<input type="submit" value="Get Answer">
</form>
<%
'------- This section only displays if they entered a number on the previous page
Dim userNumber, result
If Request.Form("txtUserEntry") <> "" Then
If isNumeric(Request.Form("txtUserEntry")) Then
userNumber = Request.Form("txtUserEntry")
result = ChallengeFunction(userNumber)
Response.Write "The sum of the digits for the number "&userNumber&" is "&result
Else
Response.Write "Your entry must be a number!"
End If
End If
'------- End Display for previous entry
'--------------------------------- ChallengeFunction Area ---------------------
Function ChallengeFunction(numStr)
End Function
'------------------------------------------------------------------------------
%>
</body>
</html>
-Tarwn "Customer Support is an art not a service" - marketing saying
"So are most other forms of torture" - programmers response
(The Wiz Biz - Rick Cook)