67) Design a form and write a program in visual basic to input name, roll and marks of five subjects of 5 students from an input data file named as marks.txt. Calculate total marks of 5 students and print name, roll and total marks of all student on screen?


Private Sub Command1_Click()
    Dim i, rn, tm, s1, s2, s3, s4, s5 As Integer
    Dim name As String
    Open "Marks.txt" For Input As #1
    Print "Name", "Roll No", "Total Marks"
    For i = 1 To 5
        Input #1, name, rn, s1, s2, s3, s4, s5
        tm = s1 + s2 + s3 + s4 + s5
        Print name, rn, tm
    Next i
    Close #1
End Sub



Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: