Advertisement
Guest User

zad1 lab10

a guest
Dec 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #define N 7
  3.  
  4. main(){
  5. int i;
  6. float liczby [N];
  7. float suma = 0;
  8.  
  9.  
  10.  
  11. printf("Program wczytuje 7 liczb rzeczywistych do tablicy. Wyswietla tablice, oraz podaje sume elementow i srednia\n");
  12.  
  13. for (i=0;i<N;i++){
  14. printf("Podaj liczbe:");
  15. scanf("%f",&liczby[i]);
  16. suma+=liczby[i];
  17.  
  18. }
  19. printf("indeks\tliczba\n");
  20.  
  21. for(i=0;i<N;i++){
  22. printf("%d\t%f\n", i, liczby[i]);
  23. }
  24.  
  25. printf("Suma = %f\n", suma);
  26. printf("Srednia = %f\n", (suma/N));
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement