fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int x, number_read;
  5. do {
  6. number_read = scanf("%d", &x);
  7. if(number_read == 0) {
  8. //printf("Unable to read integer\n");
  9. scanf("%*s"); //discard invalid input
  10. } else {
  11. printf("The integer is: %d\n", x);
  12. }
  13. } while(number_read != EOF);
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 2056KB
stdin
c
45 67
890 82934 234 5546
asdf;laas ;laksjdfiotkmkmnv;
jklasd;al;k/lkr ??A?DSf??yskaf
1 2 3 4 5
stdout
The integer is: 45
The integer is: 67
The integer is: 890
The integer is: 82934
The integer is: 234
The integer is: 5546
The integer is: 1
The integer is: 2
The integer is: 3
The integer is: 4
The integer is: 5
The integer is: 5