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
|