Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

sheila 1

Option Strict On
Module Module1

    Function alpha(ByVal n As Integer) As Double
        Return 1 / Math.Pow(2, n)
    End Function




    Sub Main()

        Dim n As Integer = CInt(Console.ReadLine())
        Dim n As Integer = CInt(Console.ReadLine())
        Dim sum As Double = 0

        For i As Integer = 1 To n
            sum = sum + alpha(i)
        Next

        Console.WriteLine(sum)

        Console.ReadKey()
    End Sub


End Module

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.