Program to input and show the elements of marks, percentage and total
marks obtained with the use of array
Source Code:-
Module Module1
Sub Main()
Dim arr(4) As Integer
Dim avg As Integer
Dim sum As Integer
Dim name As String
sum = 0
Console.WriteLine("Enter your
Name ")
name = Console.ReadLine()
For i As Integer = 0 To arr.Length - 1
Console.WriteLine("Enter your
{0} Marks:", i)
arr(i) = Convert.ToInt32(Console.ReadLine())
Next
Console.WriteLine("Your Name
:" + name)
For i As Integer = 0 To arr.Length - 1
Console.WriteLine(arr(i))
Next
For i As Integer = 0 To arr.Length - 1
sum = sum + arr(i)
Next
Console.WriteLine("Percentage
obtained :{0} %", sum)
Console.WriteLine("Total marks
:{0} ", sum / 5)
Console.ReadLine()
End Sub
End Module
Output:-
0 comments:
Post a Comment