Determine whether the factorial of a natural number is greater than or equal to 400, then calculate the square of the number, and then subtract 1 to calculate the sum of squares until the number is reduced to 0 (demonstration Exit DO)

Source: Internet
Author: User
View Code

 1 Public Class Form1 2  3     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 4         Dim number As Integer = 0 5         Dim Check As Boolean = True 6         Dim Value1 As Integer = 1 7         Dim Value2 As Integer = 0 8  9         Do10             Do While number >= 011                 number += 112                 Value1 *= number13 14                 If Value1 >= 4000 Then15                     TextBox1.Text = number16 17                     Do18                         Value2 += number ^ 219                         number -= 120                     Loop Until number = 021 22                     TextBox2.Text = Value223                     Check = False24 25                     Exit Do26                 End If27             Loop28         Loop Until (Check = False)29 30     End Sub31 32     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click33         TextBox1.Clear()34         TextBox2.Clear()35     End Sub36 End Class

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.