madina1575

madina1575

Posted on November 5, 2024

ELSE IF

Else if ham nested if kabi bir nechta shartlarni tekshirishda ishlatiladi. Ammo ularning o'rtasida farq bor.

Else if - hayotimizdagi yoki so'ziga o'xshaydi. Boshida if ishlatiladi va undan keyin else if ishlatila ketadi ya'ni oddiy qilib aytganda birinchi agar shunday bo'lsa dep, keyin yoki undaymi degan ma'nolarda keladi.

#include <iostream>

using namespace std;

int main()
{

    int son;
    cin >> son;

    if(son > 0)
    {
        cout << "musbat son" << endl;
    }
    else if(son < 0)
    {
        cout << "manfiy son" << endl;
    }
    else if(son == 0)
    {
        cout << "son nol" << endl;
    }

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu yerda birinchi if musbat sonmi yoki else if dagi manfiy sonmi yoki else ifdagi son nolga tengmi tekshirishini bildiradi.

💖 💪 🙅 🚩
madina1575
madina1575

Posted on November 5, 2024

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

Sign up to receive the latest update from our blog.

Related

NESTED WHILE LOOP
beginners NESTED WHILE LOOP

November 5, 2024

DO WHILE LOOP
beginners DO WHILE LOOP

November 5, 2024

ELSE IF
beginners ELSE IF

November 5, 2024

NESTES IF
beginners NESTES IF

November 5, 2024

FUNCTIONS
beginners FUNCTIONS

November 5, 2024