print n elements of an array, 10 per line, with each column separated by one blank, and with each line (including the last) terminated by a newline.
"%6d%c" should be used to print the answer.
Using switch is recommended.
#include <stdio.h>
void niceprint(int n);
int main()
{
int n;
while(~scanf("%d", &n)) {
niceprint(n);
}
return 0;
}
/* 请在这里填写答案 */
void niceprint(int n)
{
int i , a[n];
for (i=0;i<n;i++)
a[i]=i+1;
printf("The array has %d element%s as follows.\n",n,(n==1)?"":"s");//三目运算符
for(i=0;i<n;i++)
printf("%6d%c",a[i],(i%10==9||i==n-1)?'\n':' ');
}