fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. // read the format string
  6. char format[31];
  7. scanf("%[^\n]30s", format);
  8.  
  9. printf("Format is %s\n", format);
  10.  
  11. // amount of lines
  12. unsigned int amount = 0;
  13. scanf("%u", &amount);
  14.  
  15. // scan data
  16. for(unsigned int i = 0; i < amount; ++i)
  17. {
  18. int a=0, b=0;
  19. scanf(format, &a, &b);
  20. printf("%d %d\n", a, b);
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 2172KB
stdin
 (%d, %d) 
3
(1, 2)
(3, 4)
(5, 6)
stdout
Format is  (%d, %d) 
1 2
3 4
5 6