Advertisement
Guest User

Untitled

a guest
May 20th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6. int srednia,ilosc,suma,pomoc=0;
  7. int main()
  8. {
  9. cout<<"podaj ile liczb chcesz: ";
  10. cin>>ilosc;
  11. int tab[ilosc];
  12.  
  13. cout<<"podaj wartosci liczb oddzielone spacjami";
  14. for(int i=0;i<ilosc;i++)
  15. {
  16. cout<<endl<<i+1<<" ---> ";
  17. cin>>tab[i];
  18. suma+=tab[i];
  19. }
  20.  
  21. cout<<endl<<"suma = "<<suma<<endl;
  22. cout<<endl<<"srednia tych liczba = "<<suma/ilosc<<endl;
  23.  
  24. pomoc=tab[0];
  25. cout<<endl<<" ---> "<<pomoc<<endl;
  26. if(tab[1]>pomoc) pomoc=tab[1];
  27. if(tab[2]>pomoc) pomoc=tab[2];
  28. if(tab[3]>pomoc) pomoc=tab[3];
  29. if(tab[4]>pomoc) pomoc=tab[4];
  30.  
  31. cout<<endl<<"najwieksza liczba to ---> "<<pomoc<<endl;
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement