BCA

C LAB :PART A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10

C LAB : PART B

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10

8.Write a C program to read marks scored in 3 subjects by n students and find the average of marks and result (Demonstration of single dimensional array)

  /*Write a C program to read marks scored in 3 subjects by n students and find the average
of marks and result (Demonstration of single dimensional array)*/



#include < stdio.h>
 #include< conio.h>
void main()
{
    int n, i;
    int  studnets[100],  sub1[100],sub2[100],sub3[100];
    float avg[100];

    printf("Enter the numbers of studnets: ");
    scanf("%d", &n);


        for (i=0;i< n;i++)
        {
            printf("Enter the MARKS OF  of studnet : %d ",i);
            printf("\nsubject1:");   
            scanf("%d", &sub1[i]);
            printf("\nsubject2:"); 
            scanf("%d", &sub2[i]);
            printf("\nsubject3:"); 
            scanf("%d", &sub3[i]);

           

        }

      printf("Display Result ");
      
 for (i=0;i< n;i++)
        {
            avg[i]=(sub1[i]+sub2[i]+sub3[i])/3;
           
            if(avg[i] > 35)
                printf("\n studnet %d  is PASS : with %02f  percent",i+1,avg[i]);
            else
                printf("\n studnet %d  is FAIL :   %02f percent",i+1,avg[i]);
        }

getch();
}