Const
n = 40;
var
s,i,ind,k1,k2: integer;
mas: array[1..n] of integer;
begin
s := 0;
for i:=1 to n do s := s+ mas[i];
Writeln ('сумма элементов массива: ',s);
s := 1;
for i:=1 to n do s := s * mas[i];
Writeln ('произведение элементов массива: ',s);
s := 0;
for i:=1 to n do s := s + mas[i]*mas[i];
Writeln ('сумма квадратов элементов массива: ',s);
s := 0;
for i:=1 to 6 do s := s+ mas[i];
Writeln ('сумма первых 6 элементов массива: ',s);
ind:=0;
repeat
Writeln('Введите К1: '); read(k1);
Writeln('Введите К2: '); read(k2);
if (k2>k1) then ind := 1;
until (ind=1);
s := 0;
for i:=k1 to k2 do s := s+ mas[i];
Writeln ('сумма элементов массива с k1-го по k2-й: ',s);
end.
<span>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<span>#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
int i;
cin >> i;
string s = "Sunday";
string s1 = "Monday";
string s2 = "Tuesday";
string s3 = "Wednesday";
string s4 = "Thesday";
string s5 = "Friday";
string s6 = "Suterday";
switch(i)
{
case 1:
cout << s << endl;
break;
case 2:
cout << s1 << endl;
break;
case 3:
cout << s2 << endl;
break;
case 4:
cout << s3 << endl;
break;
case 5:
cout << s4 << endl;
break;
case 6:
cout << s5 << endl;
break;
case 7:
cout << s6 << endl;
break;
}
getch();
return 0;
<span>}
</span></span></span>
//Удачи с C++ :)
#include <iostream>
inline void sort(int *a, int *b, int *c);
int main()
{
int x, y, z;
std::cin >> x >> y >> z;
void (*ptr)(int *x, int *y, int *z);
ptr = sort;
(*ptr)(&x, &y, &z);
std::cout << x << " " << y << " " << z << std::endl;
system("pause");
return 0;
}
inline void sort(int *a, int *b, int *c)
{
if (*b < *a) std::swap(*a, *b);
if (*c < *a) std::swap(*a, *c);
if (*c < *b) std::swap(*b, *c);
}
Program getar;
uses crt;
var
S,ur:real;
god:integer;
begin
god:=0;
s:=100; //площадь
ur:=20; // урожайность
while s<=120 do
begin
god:=god+1; // подсчет лет
s:=s+((s/100)*5); // площадь ув. на 5%
ur:=ur+((ur/100)*2);// урожайн. ув. на 2%
end;
writeln('Cherez ',god,' goda ploshad budet bolshe 120 ');
end.
мне трудно объяснять на словах держи программу в ней алгоритм подсчета и тд..