inputting data with a field width : scanf field width « printf scanf « C Tutorial






#include <stdio.h>

int main()
{ 
   int x; 
   int y; 
   
   printf( "Enter a six digit integer: " );
   scanf( "%2d%d", &x, &y );

   printf( "The integers input were %d and %d\n", x, y );

   return 0; 

}
Enter a six digit integer: 1
2
The integers input were 1 and 2








4.27.scanf field width
4.27.1.inputting data with a field width