DEV Community

Asrorbek Ziyatov
Asrorbek Ziyatov

Posted on

C++ 8 - dars

c++ ko'p sonlarni ichidan end kattasi yoki kichigini miqdorini topilmoqchi bo'lsa max va min ishlatiladi ya'ni maxium va minium.

#include <iostream>
using namespace std;
int main(){

cout<<max(2,4)<< endl;
cout<< min(2,4);
}
Enter fullscreen mode Exit fullscreen mode

Natijasi:

4
2
Enter fullscreen mode Exit fullscreen mode

Max va Min faqat ikki sonni va katta va kichik sonlarni topib bera oladi. boshqa kattalikdagi sonlarni 3 xonalidan 5,xonaligacha sonlarni bir biri bilan solishtirib keyin natijalarni solishtiriladi.

blog;

#include <iostream>

using namespace std;
int main() {
  int a,s,d;
  cin >> a >> s >>d;
   cout << max(max(a,s),d) << endl;;
   cout << min(min(a,s),d);

}
Enter fullscreen mode Exit fullscreen mode

Natija:

4
1
Enter fullscreen mode Exit fullscreen mode

Top comments (0)