Last active
March 26, 2017 13:33
-
-
Save hjnowakowski/9fc9973b0886bb626aaaec4e230af1f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<time.h> | |
int main( void ) | |
{ | |
int i = 0; | |
int a[11]; | |
a[0] = 0; | |
int min = a[0]; | |
int max = a[0]; | |
double avrg; | |
srandom( (unsigned) time(NULL) ); | |
for (i=0;i<11;i++) | |
{ | |
a[i]=random( ) % 10+(-5) ; | |
printf("%d. %d\n",i, a[i]); | |
if (a[i] > max) | |
{ | |
max = a[i]; | |
} | |
else if (a[i] < min) | |
{ | |
min = a[i]; | |
} | |
} | |
printf("Min: %d\n", min); | |
printf("Max: %d\n", max); | |
for (i = 0; i < 11; i++) { | |
avrg += a[i]; | |
} | |
printf("\n\nSrednia bez podzielenia %lf", avrg); | |
printf("\n\nSrednia: %lf \n", avrg/11); | |
for (i = 0; i < 11; i++) { | |
if(a[i]>(avrg/11)) | |
printf("%d\n", a[i]); | |
} | |
return ( 0 ) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment