×

VB.Net Programs

VB.Net program to find the division of a student based on a given percentage

By Nidhi Last Updated : November 14, 2024

Finding the division of a student based on percentage

Here, we will read the percentage of a student from the user and then print the division of students using the if statement on the console screen.

VB.Net code to find the division of a student based on a given percentage

The source code to find out the division of students based on the given percentage is given below. The given program is compiled and executed successfully.

'VB.Net program to find out the division 
'based on percentage.

Module Module1

    Sub Main()
        Dim percentage As Double = 0

        Console.Write("Enter percentage: ")
        percentage = Double.Parse(Console.ReadLine())

        If percentage > 60 Then
            Console.WriteLine("First division")
        ElseIf percentage > 45 Then
            Console.WriteLine("Second division")
        ElseIf percentage > 33 Then
            Console.WriteLine("Third division")
        Else
            Console.WriteLine("You are failed")
        End If
    End Sub
    
End Module

Output:

Enter percentage: 56
Second division
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a method Main(). In the Main() method, we created a variable percentage with an initial value of 0.

Console.Write("Enter percentage: ")
percentage = Double.Parse(Console.ReadLine())

In the above code, we read the value of variable percentage from user.

If percentage > 60 Then
    Console.WriteLine("First division")
ElseIf percentage > 45 Then
    Console.WriteLine("Second division")
ElseIf percentage > 33 Then
    Console.WriteLine("Third division")
Else
    Console.WriteLine("You are failed")
End If

In the above code, we find the division of students based on a given percentage and print the division on the console screen.

VB.Net Basic Programs »


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.