Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int wyswietl(float liczba){
  7. cout<<liczba;
  8. }
  9.  
  10. int podaj_ilosc(){
  11. int ilosc;
  12. cout<<"Podaj ilosc ";
  13. cin>>ilosc;
  14. return ilosc;
  15. }
  16.  
  17. int main()
  18. {
  19. int N,liczba=0,suma=0;
  20. float srednia;
  21. N=podaj_ilosc();
  22. int tab[N];
  23. for (int i=0;i<N;i++){
  24. cout<<"Podaj liczbe ";
  25. cin>>liczba;
  26. suma+=liczba;
  27. tab[i] = liczba;
  28.  
  29. }
  30. srednia=(float)suma/(float)N;
  31. for (int j=0;j<N;j++){
  32. cout<<tab[j]<<" ";
  33. }
  34. cout<<srednia;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement