Off[General::spell1]; 
Clear[PowerMeth,A0, X0,n, m, M];
PowerMeth[A0_,X0_, M_]:=
Module[{A, Y, n },
  A=A0;
  X=X0; 
  n=Length[A];
    m=0; z=0;
    Y=A.X;   
    For[i=1, i<=n, i++,
      If[Abs[Y[[i]]] >= z, z=Abs[Y[[i]]]; m=i] ];
 Clear[Y];
 lambda = 0;
 For[k=1, k<=M, k++,
    Y = A.X;
    lambda = Y[[m]]/X[[m]];
    X = Y / Max[Abs[Y]];
    Print[N[{lambda,X},digit]  ]; ];
 Return[N[{lambda,X},digit]]; ];
On[General::spell1];

Clear[digit]; 
digit=10;

Clear[A,X];
A = {{6,5,-5},{2,6,-2},{2,5,-1}};
TableForm[A]
X = {-1,1,1}

PowerMeth[A,X, 15]

N[A.X -lambda X,8]

Clear[A,X];
A = {{1,2,3},{2,3,4},{3,4,5}}; 
TableForm[A]
X = Table[Random[Real, {-1,1}], {i,1,3}]

PowerMeth[A,X, 12]

norm[V_] :=N[ Sqrt[V^2/.List->Plus], digit]; 
norm[A.X-lambda X]

Clear[A,X];
A = Table[Table[Random[Real, {-1,1}],{i,1,6}],{i,1,6}]; 
TableForm[A]
X = Table[Random[Real, {-1,1}], {i,1,6}]

PowerMeth[A,X, 12]