Первая задачка:
#include <iostream>
#include <ctime>
using namespace std;
int main() {
setlocale(LC_ALL, "rus");
srand(time(NULL));
int x,sr1,sr2,sr=0;
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 10; i++) {
x = 1 + rand() % 10;
sr += x;
cout << x << " ";
}
cout << endl;
cout << "Среднее арифметическое этой последовательности: " << sr / 10;
cout << endl;
}
return 0;
}
Вторая задачка:
#include <iostream>
#include "math.h"
using namespace std;
int main() {
int n;
double s=0,x;
cin >> n >> x;
for (int i = 1; i <= n; i++) {
s += sin(pow(x, i));
}
cout << s;
return 0;
}
Поделитесь своими знаниями, ответьте на вопрос:
Uses GraphABC; begin SetWindowSize(1500, 1500); SetPenWidth(4); SetWindowSize(1500, 1500); Ellipse(500, 200, 830, 600); Line(500, 400, 828, 400); floodfill(605, 405, clred); floodfill(700, 345, clyellow); Ellipse(200, 200, 530, 600); Line(200, 400, 528, 400); floodfill(205, 405, clcyan); floodfill(300, 345, clmagenta); Ellipse(400, 400, 730, 800); Line(400, 600, 728, 600); floodfill(405, 605, clgreen); floodfill(500, 545, clblue); end. Найдите ошибку, если она есть
Первая задачка:
#include <iostream>
#include <ctime>
using namespace std;
int main() {
setlocale(LC_ALL, "rus");
srand(time(NULL));
int x,sr1,sr2,sr=0;
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 10; i++) {
x = 1 + rand() % 10;
sr += x;
cout << x << " ";
}
cout << endl;
cout << "Среднее арифметическое этой последовательности: " << sr / 10;
cout << endl;
}
return 0;
}
Вторая задачка:
#include <iostream>
#include "math.h"
using namespace std;
int main() {
int n;
double s=0,x;
cin >> n >> x;
for (int i = 1; i <= n; i++) {
s += sin(pow(x, i));
}
cout << s;
return 0;
}