#include
void printData(int data)
{
if (data==0)
{
return;
}
printf("%d",data%10);
printData(data/10);
}
int main()
{
int data;
printf("Enter a number:");
scanf("%d",&data);
printData(data);
printf("\n");
return 0;
}
程序如上,可以运行。
#include
#include
void print_order_number(unsigned number)
{
printf("%d",number%10);fflush(NULL);
if ( number >= 10 )
{
print_order_number(number/10);
}
}
int main(int argc, char**argv)
{
if ( argc != 2 )
{
printf("Usage: rev_print
exit(0);
}
unsigned number = atol(argv[1]);
print_order_number(number);
return 0;
}