符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
代码:
创新互联公司提供成都网站建设、网站制作、网页设计,成都品牌网站建设,1元广告等致力于企业网站建设与公司网站制作,10余年的网站开发和建站经验,助力企业信息化建设,成功案例突破上1000+,是您实现网站建设的好选择.
Imports System.IO
Public Class feibo
Function fancibo(ByVal n As Integer) As Long
If n = 2 Then
Return 1
Else
Return fancibo(n - 1) + fancibo(n - 2)
End If
End Function
Sub CreateData(ByVal max As Integer)
Dim fs As New FileStream("fb.txt", FileMode.Create, FileAccess.Write)
Dim mywriter As New BinaryWriter(fs)
Dim i As Integer
For i = 1 To max
mywriter.Write(fancibo(i))
Next i
mywriter.Close()
End Sub
Sub ReadandDealData()
Dim fs As New FileStream("fb.txt", FileMode.Open, FileAccess.Read)
Dim myreader As New BinaryReader(fs)
Dim i, s As Integer
Dim tot As Long
Dim avg As Single
i = 0 : s = 0 : tot = 0 : avg = 0.0
ListBox1.Items.Clear()
While fs.Position fs.Length
s = myreader.ReadInt64()
ListBox1.Items.Add(s)
tot += s
i += 1
End While
avg = tot / i
ListBox1.Items.Add("数据的总和:" tot)
ListBox1.Items.Add("数据的平均值:" avg)
myreader.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
CreateData(15)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ReadandDealData()
End Sub
End Class
Public Class Form1
Dim arraa%(19)
Dim i%, j%
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
arraa(0) = 1
arraa(1) = 1
arraa(2) = 1
Label2.Text = "1 1 1"
For i = 3 To 19
arraa(i) = arraa(i - 1) + arraa(i - 2) + arraa(i - 3)
Label2.Text = Label2.Text " " arraa(i)
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i = 3 To 19
If arraa(i) Mod 2 = 0 Then Label4.Text = Label4.Text " " arraa(i)
Next
End Sub
End Class
把图片上面的 数字改动 质数改成偶数就可以了
貌似有一点 没有偶数 呢
Imports System
Module Program
Sub Main()
Dim n As Integer
n=6
Console.WriteLine("{0}!={1}",n,fact(n))
n=10
For i As Integer=1 To n
Console.Write("{0}{1}",fibo(i),IIF(n=i,vbCrLf,","))
Next
Console.Write("按任意键继续。。。 ")
Console.ReadKey(True)
End Sub
' 递归算阶乘
Function fact(n As Long) As Long
If 0=n OrElse 1=n Then Return 1
Return n*fact(n-1)
End Function
' 递归算斐波那契数列
Function fibo(n As Long) As Long
If 1=n OrElse 2=n Then Return 1
Return fibo(n-1)+fibo(n-2)
End Function
End Module
斐波那契数列的发明者,是意大利数学家列昂纳多·斐波那契.
斐波那契数列指的是这样一个数列:1、1、2、3、5、8、13、21、……
下面是前1000项斐波那契数列的和的VB代码:
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim S As Long
Dim i As Integer
a = 1
b = 1
S = 2
For i = 3 To 1000
c = a + b
S = S + c
a = b
b = c
Next i
Print S
End Sub
Sub s()
n = Val(InputBox("input n:"))
ReDim arr(1 To n)
arr(1) = 1
arr(2) = 1
Debug.Print 1; 1;
For i = 3 To n
arr(i) = arr(i - 1) + arr(i - 2)
Debug.Print arr(i);
Next
End Sub
Function F(n As Long) As Long
If n 2 Then
F = F(n - 1) + F(n - 2)
Else
F = 1
End If
End Function
Private Sub Command1_Click()
Cls
Dim I As Long
I = Val(inputbox("n=?"))
Print "第 " I " 项斐波那契数列值为:" F(i)
End Sub