DEV Community

asilbek ibragimov
asilbek ibragimov

Posted on

28.0perators

28.0perators (if, else if, else, ternary operator, switch)
a) Quyidagi kodning natijasini ayting:

int score = 85;

if(score >= 90)
{
     Console. WriteLine("A");
}
else if(score >= 80)
{
     Console-WriteLine("B");
}
else if(score >= 70)
{
     Console. WriteLine("C");
}
else
{
     Console. WriteLine("F");
}
Enter fullscreen mode Exit fullscreen mode

b) switch operatoridan foydalanib, 5 ga bo'linish natijasini chiqaruvchi kod yozing. Masalan, agar x = 5 bo'lsa, "x is divisible by 5" degan natija chiqsin.

Javoblari:
a) Javob: B
b) -

Top comments (0)