madina1575
Posted on November 5, 2024
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;
}
Bu yerda birinchi if musbat sonmi yoki else if dagi manfiy sonmi yoki else ifdagi son nolga tengmi tekshirishini bildiradi.
💖 💪 🙅 🚩
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.