Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ThiHK
Language: PASCAL
Code:
Program ThiHK;
      var
        N: integer;
     A:Array[1..100] of integer;
     i, max, dem: integer;
Begin
    Write('Nhap so phan tu mang N =');Readln(N);
    For i:=1 to N do
     Begin 
           Write('Nhap phan tu thu',i,'=');
            Readln(A[i]);
      End;
    i:= 1;
    max:= A[1];
    While (i <= N) do 
        if A[i] > max then
           begin 
            max:= A[i];
               i:= i+1;
        end
        else
           begin 
               i:= 1;
               dem:= 0;
               While (i <= N) do
                    if A[i] >= max then
                      dem:= dem + 1;
                    if dem:= 1 then
                        write(' Gia tri phan tu lon nhat max =',max);
                        write(' Chi so nho nhat cua phan tu lon nhat =',i);
               i:= i + 1;
         end;
Readln;
End.
Comments: