Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Programming: output a positive integer n (integer) in the following form. For example, the output 1234567 is 1 234567.
Programming: output a positive integer n (integer) in the following form. For example, the output 1234567 is 1 234567.
# include & ltstdio.h & gt

Master ()

{

char c = ' c

int n,i=0,j=0,a[ 100];

Printf ("Please enter a positive integer n: \ n");

scanf("%d ",& ampn);

If (n< 1000)

printf("%d ",n);

other

{

for(I = 0; n & gt= 1000; i++)

{

a[I]= n % 1000;

n/= 1000;

j = I+ 1;

}

a[j]= n;

for(I = j; I>0; I-)

{

printf("%d%c ",a[i],c);

}

printf("%d ",a[0]);

}

}