DEV Community

thequvonc
thequvonc

Posted on

katta sonni aniqlash

hozir biz qaysi son katta qaysi son kichkinaligini aniqlab beruvchini yaratamiz!

#include <iostream>
using namespace std;
int main (){
int n,m;
cin >> n >> m;
(n >= m) ? cout << n : cout << m;

}
Enter fullscreen mode Exit fullscreen mode

bu yerda biz oddiy buyruqlardan yani otgan mavzudagi buyruqlarimizda foydalanmoqdamiz nima demoqchiman bu yerda chunarsiz yoki organish kerak bolgan yangi buyrular mavjud emas

bunda birinchi navbatta int ga n va m harflarini kiritib olamiz

cin >> deb uni oqiymiz

(n >= m) ? cout << n : cout << m;
Enter fullscreen mode Exit fullscreen mode

agar javob 1 yani true bolsa unda birinchisi

cout << n 
Enter fullscreen mode Exit fullscreen mode

chiqadi

agar 0 yani false bolsa

cout << m;
Enter fullscreen mode Exit fullscreen mode

natijasi chiqadi!

@dawroun

Top comments (0)