All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Guess my number (Posted on 2004-09-24) Difficulty: 2 of 5
I'm thinking of a number.
  • if it is not a multiple of 4, then it is between 60 and 69
  • if it is a multiple of 3 it is between 50 and 59
  • if it is not a multiple of 6 it is between 70 and 79.
What is the number?

See The Solution Submitted by SilverKnight    
Rating: 2.8571 (14 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 2 of 22 |

The number is 76

Program used:

Imports System
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
    Sub Main()
        Randomize()
        Dim strstarttime As String
        Dim strendtime As String
        Dim strend As String
        Dim strflag = "n"
        strstarttime = TimeOfDay
        Console.WriteLine("Start of execution: " & strstarttime)
        For index1 As Integer = 50 To 79
            findthenumber(index1)
        Next
        strendtime = TimeOfDay
        Console.WriteLine(" ")
        Console.WriteLine("Start of execution: " & strstarttime)
        strendtime = TimeOfDay
        Console.WriteLine("End of execution: " & strendtime)
        strend = "?"
        Console.WriteLine(" ")
        While strend <> "X"
            Console.WriteLine("Please enter X to exit program...")
            strend = UCase(Console.ReadLine())
        End While
    End Sub

    Sub findthenumber(ByRef index1)
        Dim strcond(3) As String
        For index2 As Integer = 0 To 2
            strcond(index2) = "?"
        Next
        If (index1 Mod 4) <> 0 Then
            If index1 >= 60 And _
            index1 <= 69 Then
                strcond(0) = "y"
            Else
                strcond(0) = "n"
            End If
        End If
        If (index1 Mod 3) = 0 Then
            If index1 >= 50 And _
            index1 <= 59 Then
                strcond(1) = "y"
            Else
                strcond(1) = "n"
            End If
        End If
        If (index1 Mod 6) <> 0 Then
            If index1 >= 70 And _
            index1 <= 79 Then
                strcond(2) = "y"
            Else
                strcond(2) = "n"
            End If
        End If
        If strcond(0) <> "n" And strcond(1) <> "n" And _
        strcond(2) <> "n" Then
            Console.WriteLine( _
            "Good: " & Str(index1))
        End If
    End Sub
End Module


  Posted by Penny on 2004-09-24 09:39:46
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information