PPS Practical 53

PPS Practical 53
  • Aim: Design a structure student_record to contain name, branch and total marks obtained. Develop a program to read data for 10 students in a class and print them.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    struct student
    {
        char person_name[100];
        char branch[100];
        int total_marks;
    } s[10];
    void main()
    {
        // clrscr();
        int i, n = 10;
        for (i = 0; i < n; i++)
        {
            printf("\nFor student %d\n", i + 1);
            printf("Enter Name  : ");
            scanf("%s", &s[i].person_name);
            printf("Enter Branch  : ");
            scanf("%s", &s[i].branch);
            printf("Enter total marks : ");
            scanf("%d", &s[i].total_marks);
        }
        printf("\nData of Students :\n");
        for (i = 0; i < n; i++)
        {
            printf("For student %d\n",i+1);
            printf("Name  : %s\n", s[i].person_name);
            printf("Branch : %s\n", s[i].branch);
            printf("Total marks : %d\n", s[i].total_marks);
        }
        // getch();
    }

Comments