|
发表于 2020-4-17 23:45:01
|
显示全部楼层
#include <stdio.h>
int main()
{
int i, n;
char *p = NULL;
printf("please input a number: ");
scanf("%d", &n);
p = (char *)malloc(n+1);
for (i = 0; i < n; i++)
{
*(p + i) = n - i + '0';
}
*(p + n) = '\0';
for (i = 0; i < n; i++)
{
printf(p + (n - i - 1));
printf("\n");
}
}
|
|