cc=[1 2 3 0 5]; d=ones(1,5);

for k=1:5,
if cc(k)==0,
   d(k)=7;
   else
      d(k)=cc(k)^2;
   end
   end