//№1
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "Enter number: ";
cin >> a;
if (a > 180)
cout << "Pass!!\n";
else
cout << "Not pass!!\n";
system("pause");
}
//№2
if (a > 50)
a += 10;
cout << a << endl;
a -= 10;
//№3
float a, b;
cout << "Enter number 1: ";
cout << "Enter number 2: ";
cin >> b;
if (a <= b)
a = 0;
cout << "Number 1: " << a << endl;
cout << "Number 2: " << b << endl;
//№4
int a, b;
if (a > 0)
a = 1;
else if (a < 0)
cout << "Number 1 is zero! " << endl;
if (b > 0)
b = 1;
else if (b < 0)
b = 0;
cout << "Number 2 is zero! " << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
//№1
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "Enter number: ";
cin >> a;
if (a > 180)
cout << "Pass!!\n";
else
cout << "Not pass!!\n";
system("pause");
}
//№2
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "Enter number: ";
cin >> a;
if (a > 50)
{
a += 10;
cout << a << endl;
}
else
{
a -= 10;
cout << a << endl;
}
system("pause");
}
//№3
#include <iostream>
using namespace std;
int main()
{
float a, b;
cout << "Enter number 1: ";
cin >> a;
cout << "Enter number 2: ";
cin >> b;
if (a <= b)
{
a = 0;
cout << "Number 1: " << a << endl;
cout << "Number 2: " << b << endl;
}
else
{
cout << "Number 1: " << a << endl;
cout << "Number 2: " << b << endl;
}
system("pause");
}
//№4
#include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter number 1: ";
cin >> a;
cout << "Enter number 2: ";
cin >> b;
if (a > 0)
{
a = 1;
cout << "Number 1: " << a << endl;
}
else if (a < 0)
{
a = 0;
cout << "Number 1: " << a << endl;
}
else
cout << "Number 1 is zero! " << endl;
if (b > 0)
{
b = 1;
cout << "Number 2: " << b << endl;
}
else if (b < 0)
{
b = 0;
cout << "Number 2: " << b << endl;
}
else
cout << "Number 2 is zero! " << endl;
system("pause");
}