全文预览

VB程序设计课件第10讲循环嵌套

上传者:随心@流浪 |  格式:ppt  |  页数:15 |  大小:192KB

文档介绍
i=2 to m-1 if m mod i=0 then Exit For ' 被整除 Next i Exit For 退出当前循环 If i=m then Label1.Text = “m是素数” Else Label1.Text = “m非素数” End if Int(Math.sqrt(m)) Evaluation only. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Copyright 2004-2011 Aspose Pty Ltd. 10 For m = 3 To 99 Step 2 Next m 【例】显示 3~100 之间的所有素数 For i = 2 To Int(Math.Sqrt(m)) If m Mod i = 0 Then Exit For Next i If i > Int(Math.Sqrt(m)) Then Label1.Text &= m Evaluation only. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Copyright 2004-2011 Aspose Pty Ltd.

收藏

分享

举报
下载此文档