Nested if

alisher0909

Alisher Maxamadjonov

Posted on November 2, 2024

Nested if

If da shart bo'lishda assignment operator ishlatish mumkin emas.
If statement dan keyin semicolon nuqtali vergul ishlatib bo'lmaydi.

Nested if - ichma ich if (nested if) dasturlashda ko'proq murakkab shartlarni, tekshirish va qarorlar qabul qilishda ishlatiladi bu shuni anglatadiki bir shart bajarilgandan keyin, yana bir shartni tekshirish zarur bo'lganda ichma ich iflardan foydalaniladi.

Nested if dan hosil bo'lgan else, if bir marta shartlarni tekshirishda ishlatiladi.

#include <iostream>

using namespace std;

int main() 
{
  int number;

  cout << "Enter an integer: ";

  cin >> number;

  if (number > 0) 
  {
    cout << "You entered a positive integer: " << number << endl;
  }

  cout << "This statement is always executed.";

  return 0;
}
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
alisher0909
Alisher Maxamadjonov

Posted on November 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related