#include <stdio.h>
int main()
{
char *str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// char *str = "9876543210";
int i, max;
i = 0;
while (str[i] != '\0')
i++;
max = i;
printf(">>%s\n", str);
printf("=>");
for (i = max - 1; i > 0; i--)
{
if (str[i] != '\0')
printf("%c", str[i]);
}
if ((i == 0) && (str[i] != '\0'))
printf("%c", str[i]);
return 0;
}
[output]:
>>ABCDEFGHIJKLMNOPQRSTUVWXYZ
=>ZYXWVUTSRQPONMLKJIHGFEDCBA
[output]:
>>9876543210
=>0123456789
沒有留言:
張貼留言