#include <stdio.h> int main() { int x, number_read; do { number_read = scanf("%d", &x); if(number_read == 0) { //printf("Unable to read integer\n"); scanf("%*s"); //discard invalid input } else { printf("The integer is: %d\n", x); } } while(number_read != EOF); return 0;}
c 45 67 890 82934 234 5546 asdf;laas ;laksjdfiotkmkmnv; jklasd;al;k/lkr ??A?DSf??yskaf 1 2 3 4 5
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
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!