Created
April 19, 2010 20:49
-
-
Save rpt/371594 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> | |
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