1. нахождение длины окружности. 2. найти квадрат суммы максимального и минимального из 3заданных чисел. 3. поиск нечетных чисел кратных 3 от 100 до 200.
int sum = _MAX(value1, _MAX(value2, value3)) + _MIN(value1, _MIN(value2, value3)); sum *= sum;
cout << sum << endl;
system("pause"); return 0; }
-= #3 =- #include <iostream>
using namespace std;
int main() { for (int i = 100; i <= 200; i++) if (i % 3 == 0 && i % 2 != 0) cout << i << "; "; cout << endl;
system("pause"); return 0; }
Vladimirovich-Aleksandrovna96
10.08.2021
#include <iostream> #include <list>
using namespace std;
int main() { list<int>mylist; //Делаем со списком, что хотим mylist.push_back(1); mylist.push_back(2); mylist.push_back(3); mylist.push_back(-4); mylist.push_back(5); for (auto i : mylist) { cout << i << " "; } cout << "\n"; //Удаляем последний отрицательный элемент auto it = mylist.end(); while (*it > 0) { if (it == mylist.begin()) { cout << "Not found.\n"; return 0; } it--; } //Делаем со списком, что хотим mylist.erase(it); for (auto i : mylist){ cout << i << " "; } return 0; }
Vladislav98
10.08.2021
Вот: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 const n=5; var a: array[1..n,1..n] of integer; i,j,s: integer; begin s: =0; randomize; for i: =1 to n do begin for j: =1 to n do begin a[i,j]: =random(10); write(a[i,j]: 4); if (i+j) mod 3=0 then s: =s+a[i,j]; end; writeln; end; writeln('s=',s); end.
#include <iostream>
using namespace std;
int main()
{
const double PI = 3,1415926535;
int radius;
cout << "Enter the radius: ";
cin >> radius;
cout << "The length of the circle = " << 2 * PI * radius << endl;
system("pause");
return 0;
}
-= #2 =-
#include <iostream>
#define _MAX(a, b) ((a) > (b) ? (a) : (b))
#define _MIN(a, b) ((a) < (b) ? (a) : (b))
using namespace std;
int main()
{
int value1, value2, value3;
cout << "Enter the numbers: ";
cin >> value1 >> value2 >> value3;
int sum = _MAX(value1, _MAX(value2, value3)) + _MIN(value1, _MIN(value2, value3));
sum *= sum;
cout << sum << endl;
system("pause");
return 0;
}
-= #3 =-
#include <iostream>
using namespace std;
int main()
{
for (int i = 100; i <= 200; i++)
if (i % 3 == 0 && i % 2 != 0)
cout << i << "; ";
cout << endl;
system("pause");
return 0;
}