創作內容

0 GP

VB2010 數字階層 (未驗證) Sn! = 1!+2!...n!

作者:艾草│2015-05-06 08:26:47│巴幣:0│人氣:222
Imports System.IO
Module Module1
    Dim sw As StreamWriter = New StreamWriter("C:\Users\scvs\Desktop\out.txt")
    Sub Main()

        Dim sr As StreamReader = New StreamReader("C:\Users\scvs\Desktop\in.txt")
        Dim a As Integer
        a = Convert.ToInt32(sr.ReadLine)

        For i = 1 To a
            Dim ab As Integer
            ab = Convert.ToInt32(sr.ReadLine)
            sw.Write(ab)
            sw.Write(" ")
            If ab >= 25 Then
                sw.WriteLine("0")
        
            Else
                danger(ab)
            End If

        Next
        sw.Close()

    End Sub
    Private Sub danger(ByVal n As Integer)
        Dim b As Integer

        Dim i, k, w, j As Integer

        Dim temp As Long = 1
        For i = 1 To n
            temp *= i

            Dim str1 As String = ""
            str1 = temp
            Dim str2 As String = ""
            str2 = Microsoft.VisualBasic.Right(str1, 6)
            Dim str3 As Integer
            For k = 1 To 6
                str3 = Mid(str2, k, 1)
                w = k
                If str3 <> 0 Then Exit For

            Next
            Dim str4 As String = ""
            str4 = Mid(str2, w, 7 - w)

            b = Convert.ToInt32(str4)
            j = j + b
        Next

        Dim kj As String = ""
        Dim wh As String = ""
        kj = Convert.ToString(j)
        wh = kj
        Dim str6 As String = ""
        str6 = Microsoft.VisualBasic.Right(kj, 6)
        For k = 1 To 6
            kj = Mid(str6, k, 1)
            w = k
            If kj <> 0 Then Exit For
        Next
        Dim str5 As String = ""
        str5 = Microsoft.VisualBasic.Right(wh, 7 - w)
        'str5 = Mid(wh, w, 7 - w)
        sw.WriteLine(str5)

    End Sub
引用網址:https://home.gamer.com.tw/TrackBack.php?sn=2828802
All rights reserved. 版權所有,保留一切權利

相關創作

留言共 0 篇留言

我要留言提醒:您尚未登入,請先登入再留言

喜歡★sakura5439 可決定是否刪除您的留言,請勿發表違反站規文字。

前一篇:VB2010 all i... 後一篇:VB2010 簡易約瑟夫...

追蹤私訊切換新版閱覽

作品資料夾

huaing123?????仔
垃圾🙂🙃看更多我要大聲說昨天23:29


face基於日前微軟官方表示 Internet Explorer 不再支援新的網路標準,可能無法使用新的應用程式來呈現網站內容,在瀏覽器支援度及網站安全性的雙重考量下,為了讓巴友們有更好的使用體驗,巴哈姆特即將於 2019年9月2日 停止支援 Internet Explorer 瀏覽器的頁面呈現和功能。
屆時建議您使用下述瀏覽器來瀏覽巴哈姆特:
。Google Chrome(推薦)
。Mozilla Firefox
。Microsoft Edge(Windows10以上的作業系統版本才可使用)

face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】