71) Design a form and write a program in visual basic to input roll no and name and marks of three subject from keyboard. Write roll no and name of only those students to an output file which marks of each subject is greater than equal to 35. Name of output file is student.txt. Also, count and print how many students which roll no and name not write to output file. Total number of student are 10?


Private Sub Command1_Click()
    Dim SName As String
    Dim rn, i, c, s1, s2, s3 As Integer
    Open "Student.txt" For Output As #1
    c = 0
    For i = 1 To 10
        SName = InputBox("Enter Student Name ", "String")
        rn = InputBox("Enter Roll No ", "Integer")
        s1 = InputBox("Enter 1st Subject Marks ", "Integer")
        s2 = InputBox("Enter 2nd Subject Marks", "Integer")
        s3 = InputBox("Enter 3rd Subject Marks", "Integer")
        If s1 >= 35 And s2 >= 35 And s3 >= 35 Then
            Write #1, rn, SName
            c = c + 1
        End If
    Next i
    Close #1
    Print "Student Not Write A File ", 10 - c
End Sub



Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: