jump to last post 1-4 of 4 discussions (4 posts)

Write a C program to compute the average marks in a subject of all the students

  1. profile image44
    aparnatrivediposted 8 years ago

    Write a C program to compute the average marks in a subject of all the students in a class.

  2. wmspringer profile image61
    wmspringerposted 7 years ago

    Set up a loop; if you know how many students, you can do a for loop, otherwise do a while loop and use a score of -1 to end the loop.

    Then add up all the scores and divide by the number of scores. You'll want to make sure at least one score was input to avoid a divide by 0 error.

  3. sambaran08 profile image56
    sambaran08posted 7 years ago

    #include
    #include
    void main()
    {
    int n, i,array[100],s=0;
    float avg;
    printf("Enter no. of students");
    scanf("%d",&n);
    printf("Enter the marks of students one by one");
    for(i=0;i

  4. bmthepro profile image57
    bmtheproposted 7 years ago

    only showing the basics , its an alternative which dosen't waste memory space much .

    main()
    {
    int i,n,num,sum;
    float avg;
    printf("how many students in the class:");
    scanf("%d",&n);
    for(i=0;i

 
working