Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main() //9 zad
  6. {
  7. ifstream odczyt ("dane.txt");
  8. int tabl[100]={0},i,z=0,x;
  9. for (i=0;i<10;i++)
  10. {
  11. odczyt>>tabl[i];
  12. }
  13. for (i=0;i<10;i++)
  14. {
  15. if(tabl[i]>z)
  16. {
  17. z=tabl[i];
  18. }
  19. }
  20. x=z;
  21. for (i=0;i<10;i++)
  22. {
  23. if(tabl[i]<x)
  24. {
  25. x=tabl[i];
  26. }
  27. }
  28. cout << "Najwieksza liczba: "<<z<<endl;
  29. cout << "Najmniejsza liczba: "<<x<<endl;
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement