Skip to content
Programmingoneonone
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone
Programmingoneonone

Learn everything about programming

C program to count the number of students in each group

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program in which we have given below is the list of marks obtained by a class of 50 students in an annual examination. 43 65 51 27 79 11 56 61 82 09 25 36 07 49 55 63 74 81 49 37 40 49 16 75 87 91 33 24 58 78 65 56 76 67 45 36 63 12 21 73 49 51 19 39 49 68 93 85 59

Write a program to count the number of students belonging to each of the following groups of marks: 0-9,10-19,20-29,—,100. C Programming with practical program code and step-by-step full complete explanation.

C Program to count the number of students in each group

C Program to count the number of students in each group.

 
#include<stdio.h>
#include<conio.h>

#define MAXVAL 50
#define COUNTER 11

void main()
{
    float value[MAXVAL];

    int i, low, high;
    int group[COUNTER]={0,0,0,0,0,0,0,0,0,0,0};

    for(i=0;i<MAXVAL;i++)
    {
        scanf("%f",&value[i]);
        ++group[(int)(value[i]/10)];
    }

    printf("n");
    printf("GROUP RANGE FREQUENCEY");

    for(i=0;i<COUNTER;i++)
    {
        low=i*10
        if(i==10)
            high=100;
        else
            high=low+9;
        printf("%2d%3d to %3d%d",i+1,low,high,group[i]);
    }
}

Output

 
43 65 51 27 79 11 56 61 82 09 25 36 07 49 55 63 74 81 49 37 40 49 16 75 87 91 33 24 58 78 65 56 76 67 45 54 36 63 12 21 73 49 51 19 39 49 68 93 85 59    

GROUP          RANGE          FREQUENCY
1              0 to 9         2
2              10 to 19       4
3              20 to 29       4
4              30 to 39       5
5              40 to 49       8
6              50 to 59       8
7              60 to 69       7
8              70 to 79       6
9              80 to 89       4
10             90 to 99       2
11             100 to 100     0
c coding problems solutions

Post navigation

Previous post
Next post

Are you a student and stuck with your career or worried about real-time things, and don't know how to manage your learning phase? Which profession to choose? and how to learn new things according to your goal, and land a dream job. Then this might help to you.

Hi My name is YASH PAL, founder of this Blog and a Senior Software engineer with 5+ years of Industry experience. I personally helped 40+ students to make a clear goal in their professional lives. Just book a one-on-one personal call with me for 30 minutes for 300 Rupees. Ask all your doubts and questions related to your career to set a clear roadmap for your professional life.

Book session - https://wa.me/qr/JQ2LAS7AASE2M1

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes