E) [48, 53, 67, 100,
0,
0)
7. дан фрагмент программы:
size='hеіght - {2}, length - 10}, width - (1,
print (size.format (3, 6, 2.3))
что будет выведено на экран?
a) 'length - 3, width - 6, height - 2.3'
b) 'length - 2.3, width - 3, height - 6'
c 'height - 2.3, length - 3, width - 6'
d) 'height - 3, length - 6, width - 2.3'
e) "height - 2}, length - {0}, width - {1}".
,
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cin >> a;
int d = a%10;
string s = "yes";
while(abs(a) > 0) {
if(a%10 != d) {
s = "no";
break;
}
a/=10;
}
cout << s << endl;
}
2)
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cin >> a;
int d = a%10;
a/=10;
string s = "no";
while(abs(a) > 0) {
if(a%10 == d) {
s = "yes";
break;
}
d = a%10;
a/=10;
}
cout << s << endl;
}
#include <iostream>
using namespace std;
int main() {
unsigned int n;
cout << "N = ";
cin >> n;
float a[n][n],
sum = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << "a[" << i
<< "][" << j
<< "] = ";
cin >> a[i][j];
sum += a[i][j];
}
}
float avg = sum / (n * n);
cout << "Среднее арифметическое - "
<< avg << ", начинаю замену...\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] < 0) {
cout << "a[" << i
<< "][" << j
<< "] = " << a[i][j]
<< " < 0, заменяю на "
<< avg << "...\n";
a[i][j] = avg;
}
}
}
cout << "\nИзменённый массив:\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << a[i][j];
if ( !(j == n - 1) ) cout << ' ';
}
if ( !(i == n - 1) ) cout << '\n';
}
return 0;
}
// #2
#include <iostream>
using namespace std;
const unsigned short int n = 7;
int main() {
int a[n][n],
max;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << "a[" << i
<< "][" << j
<< "] = ";
cin >> a[i][j];
}
}
max = a[0][0];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if ( (a[i][j] > max) && (i + j > n + 1) )
max = a[i][j];
}
}
cout << "Максимум ниже побочной диагонали: "
<< max;
return 0;
}