DEV Community

madina1575
madina1575

Posted on

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.

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more