Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- int tab[20];
- int i, suma;
- float srednia; /* generowanie pseudolosowe elementów macierzy */
- srand(time(NULL));
- for(i=0; i<20; i++)
- tab[20] = rand() % 10;
- for(i=0; i<20; i++)
- {
- printf("%3d",tab[20]);
- printf( "\n" );
- }
- printf( "\n");
- suma = 0;
- for(i=0; i<20; i++)
- suma = suma + tab[20];
- srednia = (float) suma/(20);
- printf("Suma elementow: %d\n",suma);
- printf("Srednia arytmetyczna: %f\n \n",srednia);
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement