Facebook
From sdaf, 9 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 78
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int a,b,min,max,i;
  5. unsigned int n;
  6. i=4;
  7. cout<<"podaj liczbe elemetow\n";
  8. cout<<"n=";
  9. cin>>n;
  10. cout<<endl;
  11. if(i==0)cout<<"podales nieprawidlowa liczba";
  12. else{
  13. if(n>=2)
  14. }
  15. cout<<"a=";
  16. cin>>a;
  17. cout<<"b=";
  18. cin>>b;
  19. if(a>b){
  20. min=b
  21. max=a
  22. }
  23. else{
  24. min=a
  25. max=b  
  26. }
  27. while(i<=n){
  28. cout<<"a=";
  29. cin>>a;
  30. cout<<"b=";
  31. cin>>b;
  32. if(a>b){
  33. if(a>max)max=a;
  34. if(b<min)min=b;
  35. }
  36. else
  37. {
  38. if(b>max)max=b;
  39. if(a<min)min=a;
  40. }
  41. i+=2;