Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2007, 06:16 PM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Basim
Default plz correct my programe

i have to complete this task

Write a program that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print

4 2 3 3 9

 [Hint: This exercise is possible with the use of both division and modulus operations to “pick off” each digit.]
For the purpose of this exercise, assume that the user enters the correct number of digits.

i tried to make this programe but its not working for all inputs plz check my programe and guide me where im making mistake thankx

Module Module1

    Sub Main()
        Dim input As Double

        Dim result0 As Double
        Dim result1 As Integer
        Dim result2 As Integer
        Dim result3 As Integer
        Dim result4 As Integer
        Dim result5 As Integer
        Dim result6 As Integer
        Dim result7 As Integer

        System.Console.WriteLine("Enter a Five Digits number")
        input = System.Console.ReadLine()

        result0 = (input Mod 10)

        result1 = input / 10

        result2 = (result1 Mod 10)

        result3 = (result1 / 10)

        result4 = result3 Mod 10

        result5 = result3 / 10

        result6 = result5 Mod 10

        result7 = result5 / 10

        System.Console.WriteLine("{0} {1} {2} {3} {4}", result7, result6, result4, result2, result0)


        System.Console.ReadLine()
    End Sub

End Module


basim
 
Old October 30th, 2007, 01:37 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

When you say, “its [sic] not working for all inputs,” what is the incorrect behavior, and what is the input that causes it?





Similar Threads
Thread Thread Starter Forum Replies Last Post
plz.....plz solve out my problem.... kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 October 4th, 2007 12:56 PM
Is it correct like this ? tunisiano C# 1 March 7th, 2007 12:22 PM
Debug Programe u.muslimboy BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 October 5th, 2006 02:22 PM
pageload is not correct... pc_35 ASP.NET 1.0 and 1.1 Basics 5 September 26th, 2006 09:20 AM
correct syntax? crmpicco Classic ASP Basics 2 February 10th, 2005 05:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.