DEV Community

feyyame1
feyyame1

Posted on

if statement: Haqida malumot.

tanlov bayonotlari
Ikki yoki undan ortiq ijro yo'llari o'rtasidan tanlimiz.
If iborasi if esle iborasi switch iborasi.


Enter fullscreen mode Exit fullscreen mode
Misoolar
   Bizga butun qiymat berilgan
Agar musbat (>0) bolsa,qiymatni ekranga chiqaramiz.
Agar manfiy bo'lsa,(<0) -1ni ekranga chiqaramiz.

Enter fullscreen mode Exit fullscreen mode


int main () {
int age1, age2;
  cin>> age1>> age2;

  if (age1 > age2){
  cout << "Birinchi kiritilgani katta: Bu son:" << age1;

  }
  if(age1 == age2){
    cout << "ular teng!";
  }
Enter fullscreen mode Exit fullscreen mode
Agar ifoda rost bo'lsa, 1- bandni bajaring.
sintaksis.
If (ifoda){
bayonot1
}
Enter fullscreen mode Exit fullscreen mode

*MIsol uchun , agar x o dan katta bo'lsa,
"musbat raqami"ni ekranga chiqaramiz\n
*

int main(){
int x;
cin >> x;
if(x > -10 && x < 10){
x = 0;
cout << x;
  }
return 0;
  }

Enter fullscreen mode Exit fullscreen mode

Top comments (0)