ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to demonstrate the Chr() function

Here, we are going to demonstrate the Chr() function in VB.Net.
Submitted by Nidhi, on December 04, 2020

The Chr() function is used to get character against the given ASCII value.

Syntax:

Chr(num)

Parameters:

  • num: It is an ASCII value.

Return Value:

The Chr() function will return the character corresponding ASCII value.

Program/Source Code:

The source code to demonstrate the Chr() function is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the Chr() function.

Module Module1

    Sub Main()
        Dim num As Integer = 67
        Dim ch As Char

        ch = Chr(num)

        Console.WriteLine("Character: {0}", ch)
    End Sub

End Module

Output:

Character: C
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() method. In the Main() method, we created two variables num and ch, here variable num is initialized with 67. As we know that the 67 is the ASCII value of character "C".

ch = Chr(num)

In the above code, we used the Chr() function that will return the character corresponding ASCII value. Then we printed the character on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

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.