#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n > 0)
{
cout << "1";
}
else
{
cout << "0";
}
return 0;
}
if bu shart togri berilgan bolsa if ichiga nima yozgan bosiz shuni chiqardi.
else bu shart xato bsa shuni ichiga kiradi yozgan narsani chiqardi.
Bizda else if bor bu kodni namunada korsiz boladi.
#include <iostream>
using namespace std;
int main()
{
int son;
cout << "Istalgan son kiriting: ";
cin >> son;
if (son > 0)
{
cout << "Bu son musbat." << endl;
} else if (son < 0)
{
cout << "Bu son manfiy." << endl;
} else
{
cout << "Bu son nolga teng." << endl;
}
return 0;
}
else if bu agar birinchi if ishlmasa kengisiga otadi.
Top comments (0)