Ответ:
var j,i,k,n:integer;
m:array[1..1000] of integer;
begin
read(n,k);
//Ввод элементов массива
for i:=1 to n do
read(m[i]);
//Сортировка по возрастанию
for i:=1 to k do
for j:=i to k do
if m[j]<m[i] then swap(m[i],m[j]);
//Сортировка по убыванию
for i:=k+1 to n do
for j:=i to n do
if m[j]>m[i] then swap(m[i],m[j]);
//Вывод элементов массива
for i:=1 to n do
print(m[i]);
end.
Function Sum(m: myarray): Integer
Var i, s : integer
sum:=0
For i:=1 To n do
(к уже найденной сумме первых (i-1) элементов прибавляем i-ый элемент)
s:=s+m[i];
sum:=s;
End;
Это все что я помню...
Procedure ABCD(Const A:real; Var B,C,D:real);
Begin
B:=A*A;
C:=B*A;
D:=C*A;
End;
Var
A,B,C,D:real;
Begin
Write('A = ');ReadLn(A);
ABCD(A,B,C,D);
WriteLn(A,' ',B,' ',C,' ',D);
End.
Пример вычислений для 10-ти разных чисел:
A = 1
1 1 1 1
A = 2
2 4 8 16
A = 3
3 9 27 81
A = -10
-10 100 -1000 10000
A = 3.141592
3.141592 9.869600294464 31.0062573282858 97.4090099724839
A = 111
111 12321 1367631 151807041
A = 6.66
6.66 44.3556 295.408296 1967.41925136
A = -2.718121812
-2.718121812 7.38818618487016 -20.0819900202127 54.5852951023063
A = 789456123
789456123 6.23240970142191E+17 4.92021399983213E+26 3.8842930686378E+35
A = 123456789
123456789 1.52415787501905E+16 1.88167637178915E+24 2.32305722798259E+32
Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
for (int i = 5; i >= 1; i--)
{
for (int j = i; j >= 1; j--)
{
Console.Write(j);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}