Номер 6:
#include
using namespace std;
int main()
{
int num[3];
cout << "Enter three numbers: "; <br>cin >> num[0] >> num[1] >> num[2];
int sum = 0;
for (int i = 0; i < 3; i++)
{
if (num[i] > 0)
sum = sum + num[i];
}
cout << endl << "Sum = " << sum << endl; <br>
return 0;
}
-----------------------------------------
Номер 7:
#include
using namespace std;
int main()
{
int num[3];
cout << "Enter three numbers: "; <br>cin >> num[0] >> num[1] >> num[2];
int counter = 0;
for (int i = 0; i < 3; i++)
{
if (num[i] % 2 == 0)
counter++;
}
cout << endl << "Even numbers = " << counter << endl; <br>
return 0;
}
-----------------------------------------
Номер 8:
#include
using namespace std;
int main()
{
int num1, num2, num3, number;
cout << "Enter number: "; <br>cin >> number;
if (number > 99 && number < 1000)
{
num1 = number / 100;
num2 = number / 10;
num2 = number % 10;
num3 = number % 10;
if (num1 == num3)
cout << endl << "Palidrom!" << endl; <br>
else
cout << endl << "Not Palidrom!" << endl; <br>}
else
cout << endl << "Uncorrect number!" << endl; <br>
return 0;
}
-----------------------------------------
Номер 12:
#include
using namespace std;
int main()
{
int max, min, central, tmp;
cout << "Enter first number: "; <br>cin >> max;
cout << "Enter second number: "; <br>cin >> min;
if (min > max)
{
tmp = max;
max = min;
min = tmp;
}
cout << "Enter third number: "; <br>cin >> central;
if (central > max)
{
tmp = max;
max = central;
central = tmp;
}
else if (central < min)
{
tmp = min;
min = central;
central = tmp;
}
cout << endl << "Central number = " << central << endl; <br>
return 0;
}