Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int N, i, suma=0;
- int tab[N];
- printf("Podaj wielkosc tablicy: \n");
- scanf("%d", &N);
- srand((unsigned) time (NULL));
- for(i=0; i<N; i++)
- {
- tab[i] = rand() % 10;
- printf("%d\t", tab[i]);
- }
- for(i=0; i<N; i++)
- {
- suma+=tab[i];
- }
- printf("Suma wszystkich elementow wynosi: %d\n\n", suma);
- printf("Suma arytmetyczna %d- elementowej tablicy wynosi: %f\n\n", N, (float)suma/N);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement