Viết chương trình nhập vào n sô nguyên dương của mảng a Tìm phần tử lớn hơn 1 trong mảng và chỉ ra vị trí của nó .

2 câu trả lời

Program BTT;
Uses crt;
Var A: array[1..1000] of longint;
    n,i: longint;
Begin
        Clrscr;
        Write('Nhap n: '); Readln(n);
        For i:=1 to n do
        Begin
                Write('A[',i,'] = ');
                Readln(A[i]);
        End;
        For i:=1 to n do
                If A[i]>1 then Write(i,' ');
        Readln
End.

Program timpt;
Uses crt;
Var A: array[1..1000] of integer;
    n,i: integer;
Begin
        Clrscr;
        Write('Nhap n: '); Readln(n);
        For i:=1 to n do
        Begin
                Write('Nhap A[',i,'] = ');
                Readln(A[i]);
        End;
        For i:=1 to n do If A[i]>1 then Write(i,' ');
        Readln;
End.

Câu hỏi trong lớp Xem thêm