#define N 10
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "Rus");
int mas[N];
cout << "Исходный массив: ";
for (int i = 0; i < N; i++) {
cin >> mas[i];
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N-1; j++) {
if (mas[j] > mas[j + 1]){
int d = mas[j];
mas[j] = mas[j + 1];
mas[j + 1] = d;
}
}
}
cout << "\nОтсортированный массив: ";
for (int i = 0; i < N; i++)
cout << mas[i] << " ";
return 0;
}
#include <iostream>
#include <math.h>
#define PI 3.14159
int main()
{
using namespace std;
float a,b,result;
cin>>a>>b;
float result=a+b;
cout<<"Slozhenie a+b = "<<result<<endl;
result=a-b;
cout<<"Raznost a-b ="<<result<<endl;
result=a*b;
cout<<"a*b ="<<result<<endl;
result=a/b;
cout<<"a/b ="<<result<<endl;
result=sin(a*PI/180); //для а в градусах
cout<<"sin(a gradusov) ="<<result<<endl;
result=sin(b); //для b радиан
cout<<"sin(b radian) ="<<result<<endl;
result=sqrt(a*b); //квадратный корень перемножения а*б
cout<<"sqrt(a*b) ="<<result<<endl;
return 0;
}
Const
n=15;
Var
ar:array[1..n] of integer;
pro,i,k:uint64;
begin
randomize;
pro:=1;
writeln('First array:');
for i:=1 to n do
begin
ar[i]:=random(22,23); //Серьёно?
write(ar[i]:4);
pro:=pro*ar[i];
end;
writeln;
writeln('Pro=',pro);
write('Enter value:');
readln(k);
writeln('Final array:');
for i:=1 to n do
begin
ar[i]:=ar[i]+k;
write(ar[i]:6);
end;
end.
Пример работы программы:
First array:
23 23 22 22 22 22 23 23 23 22 23 22 22 23 23
Pro=10868183115618730368
Enter value:3
Final array:
26 26 25 25 25 25 26 26 26 25 26 25 25 26 26