ADVERTISEMENT
ADVERTISEMENT

VB.Net program to get the sequence of integer numbers within a specified range

Here, we are going to learn how to get the sequence of integer numbers within a specified range in VB.Net?
Submitted by Nidhi, on February 02, 2021

In this program, we will use Range() method of the Enumerable class to get the sequence of integer numbers within a specified range.

Program/Source Code:

The source code to get the sequence of integer numbers within a specified range is given below. The given program is compiled and executed successfully.

'VB.NET program to get the sequence of integer numbers 
'within a specified range.

Module Module1
    Sub Main()
        Dim intValues = Enumerable.Range(21, 10)

        Console.WriteLine("Sequence of elements:")
        For i = 0 To intValues.Count() - 1 Step 1
            Console.Write(intValues.ElementAt(i) & " ")
        Next
        Console.WriteLine()
    End Sub
End Module

Output:

Sequence of elements:
21 22 23 24 25 26 27 28 29 30
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() function. The Main() function is the entry point for the program.

In the Main() function, We got the range of integer elements from a specified value using the Range() method of the Enumerable class and print those elements on the console screen.

VB.Net LINQ Query Programs »



ADVERTISEMENT




ADVERTISEMENT


Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.