/* File: inch3.c Draw an inch worm, inching across the screen. This time using a for loop. Now, draw the food pellet, too. */ #include #include int main() { int i, j ; for (i=0 ; i <= 20 ; i++) { printf("\033[2J"); // clear screen printf("\033[H"); // go home for (j=0 ; j <= i ; j++) { printf(" ") ; } printf("_/\\_") ; for (j=20 ; j >= i ; j--) { printf(" ") ; } printf("o\n") ; usleep(350000) ; printf("\033[2J"); // clear screen printf("\033[H"); // go home for (j=0 ; j <= i ; j++) { printf(" ") ; } printf("_____") ; for (j=20 ; j >= i+1 ; j--) { printf(" ") ; } printf("o\n") ; usleep(350000) ; } return 0 ; }