QUARTILE Algorithm

The quartile algorithm is a statistical method used to describe and analyze the dispersion and spread of a data set, by dividing the data into four equal parts after sorting it in ascending order. The primary goal of the quartile algorithm is to provide a clear picture of the data distribution and identify any potential outliers. The algorithm calculates three main values, known as the first quartile (Q1), the second quartile (Q2), and the third quartile (Q3). Q1 represents the value below which 25% of the data falls, Q2, also known as the median, is the value below which 50% of the data falls, and Q3 represents the value below which 75% of the data falls. The interquartile range (IQR), which is the difference between Q3 and Q1, is often used to measure the spread of the data. One of the key advantages of the quartile algorithm is its robustness to outliers, as it is less sensitive to extreme values in the data set compared to other measures of dispersion such as the mean and standard deviation. The algorithm is particularly useful in identifying skewness in the distribution of data, as the position of the quartiles and the width of the IQR can indicate whether the data is symmetric or skewed to one side. In addition to providing a simple and intuitive way of understanding the spread and distribution of data, the quartile algorithm can also be utilized as a basis for other statistical tests and techniques, such as box plots, which provide a visual representation of the data based on the quartiles and help in identifying potential outliers and patterns in the data.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
	int a[10],n,i,j,temp;
	float q1,q3,iqr;
	clrscr();
	printf("Enter no. for Random Numbers :");
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		a[i]=rand()%100;
	}
	printf("Random Numbers Generated are :\n");
	for(i=0;i<n;i++)
	{
		printf("\n%d",a[i]);
	}
	printf("\n");
	printf("\nSorted Data:");
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			if(a[i]<a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		printf("\n%d",a[i]);
	}
	q1=a[n/4];
	printf("\nFirst Quartile : %f",q1);
	q3=a[(3*n)/4];
	printf("\nThird Quartile : %f",q3);
	iqr=q3-q1;
	printf("\nInterQuartile Range is : %f",iqr);
	getch();
}

LANGUAGE:

DARK MODE: