Frequency distribution in C source code: This program provides you a frequency distributed output for a given input range. This can be a simple code to understand easily. It generates the 10 eventually distributed intervals. It is totally based on your “10” numbers of input.
This C program is used to create the frequency table for distributing range of frequency by using the table of frequency values.
Frequency distribution program:
Q: Write a C program to create a frequency distribution.
//Header files #include<stdio.h> void main() { //Pogram variables int count[]={0,0,0,0,0,0,0,0,0,0}; int i,j; int arr[10]; //Array declaration printf("Enter ten values"); for (i=0;i<10;i++) //Looping statement { scanf("%d",&arr[i]); j=arr[i]/10; if(j<10) //Conditional statement count[j]++; else count[10]++; } // © http://students3k.com printf("Range\t frequency"); for(i=0;i<10;i++) printf("\n%d-%d\t %d",i*10,i*10+9,count[i]); getch(); }