Home > Back-end >  The great god this degree should be how to write
The great god this degree should be how to write

Time:10-04

CodePudding user response:

It seems that must use an array,
Related functions: atoi, itoa

CodePudding user response:

Now that are limited in the positive integer, out over directly to die for your data, and then find an order (or don't need to sort)

CodePudding user response:

For your reference
 
# include & lt; stdio.h>
# define ARRLEN 10

Int main ()
{
Int I, j=0, n, k;
Int a [ARRLEN]={0};
Printf (" please enter an integer: \ n ");
The scanf (" % d ", & amp; N);

I=n;
//determine the input integer digit
While (I)
{
j++;
I/=10;
}

//remove the individual bits of digital
I=0;
For (k=0; k{
I=n % 10;
A [k]=I;
N/a=10;
}

Printf (" output every: \ n ");
For (k=j - 1; K>=0; K -)
{
Printf (" % d ", a [k]);
}

Printf (" \ n reverse output every: \ n ");
For (k=0; k{
Printf (" % d ", a [k]);
}

return 0;
}

CodePudding user response:

Use digits log10, other nothing difficult
  • Related