Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int clean_stdin()
- {
- while (getchar()!='\n');
- return 1;
- }
- int main(void)
- {
- int rows =0;
- char c;
- do
- {
- printf("\nEnter an integer: ");
- } while (((scanf("%d%c", &rows, &c)!=2 || c!='\n') && clean_stdin()));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement