Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C how to use for loop to take out every bit of n digits (n is entered by keyboard) and output it?
C how to use for loop to take out every bit of n digits (n is entered by keyboard) and output it?
Define a variable A, input the variable and assign a value, use the for loop to take the remainder of A, output the remainder, and divide it by 10 until A equals 0.

//Reference code?

# include & ltstdio.h & gt

int? Master ()

{

int? N, I; //Define integer variables?

scanf("%d ",& ampn); //Input assignment?

for(; n & gt0; ) {//Take the remainder of the variable and output the remainder. Divide the variable by 10 until the variable equals 0?

printf("%d ",n % 10); //Output remainder?

n/= 10; //Divide the variable by 10?

}

printf(" \ n ");

Return? 0;

}

/* Running result:?

123456

65432 1

*/