完善下列程序每小題在PASCAL語言(a)和C語言(b)中任選一題下面的程序將數列…n*n依次按蛇型方式存放在二維數組A[nn]中即 (示意圖編者略)
(a)算法的PASCAL 語言程序描述(編者略)(b)算法的C語言程序描述
#define NMAX
#include stdioh
main()
{ int ijnkpqm;
int a [NMAX][NMAX];
scanf(%d&n);
m=;
for(k=__()__ k++)
{if(k<n) q=k else__()__;
for(p=;p<=q;p++)
{if__()__ {i=qp+j=p}
else{i=pj=qp+}
if__()__ {i=i+nqj=j+nq}
a[i][j]=m__()__;
}
for(i=i<=n;i++)
{ for(j=j<=nj++)
printf(%da[i][j]);printf(\n);
}
}
}【上海大學 六 (分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/22783.html