64,653
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
int main()
{
int n = 0;
puts("Please input a number between 0 and 9");
scanf("%d",&n);
while(n < 0 || n > 9)
{
puts("\ninput error!\nplease retry:");
scanf("%d",&n);
}
///////
for(int i = - n, j = - n; i <= n || ++j <= n && (i = - n) && putchar('\n'); i++)
printf("%d ", std::max(abs(i),abs(j)));
//////
system("pause");
return 0;
}