Const N = 4; M = 6; Var A:array[1..N,1..M] of integer; B:array[1..N] of integer; i,j,k:integer; C:real; Begin WriteLn('Введите массив:'); For i:= 1 to N do For j:= 1 to M do Read(A[i,j]); WriteLn; Write('Введите число: ');ReadLn(C); For i:= 1 to N do Begin k:=0; For j:= 1 to M do if C<A[i,j] then k:=k+1; B[i]:=k; End; WriteLn; For i:= 1 to N do Write(B[i],' ') End.
namespace old4Test1
{
class Program
{
static void Main()
{
Console.WriteLine(IsFirstBiggerThanLast(123456));
Console.WriteLine(IsFirstBiggerThanLast(62514));
Console.WriteLine(IsFirstBiggerThanLast(1));
Console.WriteLine(IsFirstBiggerThanLast(12));
Console.WriteLine(IsFirstBiggerThanLast(105));
Console.ReadKey();
}
// Определите,какая цифра числа-первая или последняя больше. C#
private static bool IsFirstBiggerThanLast(int number)
{
Console.WriteLine(number);
var s = number.ToString();
return s[0] > s[s.Length - 1];
}
}
}
N = 4;
M = 6;
Var
A:array[1..N,1..M] of integer;
B:array[1..N] of integer;
i,j,k:integer;
C:real;
Begin
WriteLn('Введите массив:');
For i:= 1 to N do
For j:= 1 to M do
Read(A[i,j]);
WriteLn;
Write('Введите число: ');ReadLn(C);
For i:= 1 to N do
Begin
k:=0;
For j:= 1 to M do
if C<A[i,j] then k:=k+1;
B[i]:=k;
End;
WriteLn;
For i:= 1 to N do
Write(B[i],' ')
End.
Пример:
Введите массив:
4 6 2 6 -6 -6
5 2 7 -3 6 -3
-2 -8 -1 3 4 1
-8 -5 -4 10 -5 6
Введите число: 4
2 3 0 2