All pastes #746488 Raw Edit

Something

public text v1 · immutable
·published 2007-10-23 06:58 UTC
rendered paste body
Option Strict On
Imports System.Console
Module Module1
    Sub Main()
        Const LUKULKM As Integer = 8
        Dim positiiviset(LUKULKM - 1) As Integer
        Dim negatiiviset(LUKULKM - 1) As Integer
        Dim i, neg, pos As Integer
        Dim luku As String
        WriteLine("Anna 8 kokonaislukua, joko positiivisia tai negatiivisia arvoja")
        neg = 0
        pos = 0
        For i = 1 To LUKULKM
            Do
                Write("Anna {0} luku: ", i)
                luku = CStr(ReadLine())
                If IsNumeric(luku) = True Then
                    If CInt(luku) < 0 Then
                        negatiiviset(neg) = CInt(luku)
                        neg = neg + 1
                    ElseIf CInt(luku) >= 0 Then
                        positiiviset(pos) = CInt(luku)
                        pos = pos + 1
                    End If
                Else
                    WriteLine("Tarkasta syöte")
                End If
            Loop Until IsNumeric(luku) = True
        Next
        WriteLine("*************************")
        WriteLine("Positiiviset luvut")
        For i = 1 To pos
            WriteLine(positiiviset(i - 1))
        Next
        WriteLine("Negatiiviset luvut")
        For i = 1 To neg
            WriteLine(negatiiviset(i - 1))
        Next
        ReadLine()
    End Sub
End Module