mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
remove conio.h
This commit is contained in:
parent
45398453be
commit
def308b785
@ -1,45 +1,47 @@
|
|||||||
#include<stdio.h>
|
#include <stdio.h>
|
||||||
#include<conio.h>
|
#include <stdlib.h>
|
||||||
#include<math.h>
|
#include <math.h>
|
||||||
void main()
|
|
||||||
|
int main()
|
||||||
{
|
{
|
||||||
int a[10],n,i,j,temp;
|
int a[10], n, i, j, temp;
|
||||||
float q1,q3,iqr;
|
float q1, q3, iqr;
|
||||||
clrscr();
|
|
||||||
printf("Enter no. for Random Numbers :");
|
printf("Enter no. for Random Numbers :");
|
||||||
scanf("%d",&n);
|
scanf("%d", &n);
|
||||||
for(i=0;i<n;i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
a[i]=rand()%100;
|
a[i] = rand() % 100;
|
||||||
}
|
}
|
||||||
printf("Random Numbers Generated are :\n");
|
printf("Random Numbers Generated are :\n");
|
||||||
for(i=0;i<n;i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
printf("\n%d",a[i]);
|
printf("\n%d", a[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("\nSorted Data:");
|
printf("\nSorted Data:");
|
||||||
for(i=0;i<n;i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<n;j++)
|
for (j = 0; j < n; j++)
|
||||||
{
|
{
|
||||||
if(a[i]<a[j])
|
if (a[i] < a[j])
|
||||||
{
|
{
|
||||||
temp=a[i];
|
temp = a[i];
|
||||||
a[i]=a[j];
|
a[i] = a[j];
|
||||||
a[j]=temp;
|
a[j] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<n;i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
printf("\n%d",a[i]);
|
printf("\n%d", a[i]);
|
||||||
}
|
}
|
||||||
q1=a[n/4];
|
q1 = a[n / 4];
|
||||||
printf("\nFirst Quartile : %f",q1);
|
printf("\nFirst Quartile : %f", q1);
|
||||||
q3=a[(3*n)/4];
|
q3 = a[(3 * n) / 4];
|
||||||
printf("\nThird Quartile : %f",q3);
|
printf("\nThird Quartile : %f", q3);
|
||||||
iqr=q3-q1;
|
iqr = q3 - q1;
|
||||||
printf("\nInterQuartile Range is : %f",iqr);
|
printf("\nInterQuartile Range is : %f", iqr);
|
||||||
getch();
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user