Skip to content

Instantly share code, notes, and snippets.

@rpt
Created April 19, 2010 20:49
Show Gist options
  • Save rpt/371594 to your computer and use it in GitHub Desktop.
Save rpt/371594 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main() {
float liczby[10];
int i, suma=0;
srand(time(NULL));
printf("Generuje tablice 10-ciu floatow...\n");
for (i=0; i<=9; i++) {
liczby[i]=rand()%100+(float)rand()/(float)RAND_MAX;
printf("%f\n", liczby[i]);
suma+=liczby[i];
}
printf("Srednia liczb z tablicy to: %d\n", suma/(i+1));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment