Question: write c code An Octocat has 8 tentacles. One might ask how high an Octocat can count... and the answer is not 8 . It

write c code
write c code An Octocat has 8 tentacles. One might ask how
high an Octocat can count... and the answer is not 8 .

An Octocat has 8 tentacles. One might ask how high an Octocat can count... and the answer is not 8 . It ends up that an Octocat is very intelligent and has learned to count using all of its tentacles. 0 is when all tentacles are down. If its first tentacle is up, that's 1 . The second tentacle is 2 . If both the first and second are up, that's 3 . If the 3rd tentacle is up, that's 4 . Each tentacle has a value. When the "up" tentacles are added together, that's the number it's thinking of. When all 8 tentacles are up, it has counted to 255 ! Your job is to count like an Octocat... and write a C program to output all possible tentacle positions. your program should print all of the values in between ... 248:251252:253! ...where a - is a "down" tentacle and a is an "up" tentacle. Resize your terminal window so it's nice and wide. Notes - Here's how to print a number with 3 spaces of left-padding: printf( 483d:",x); - Compile and run the program in 1 line like this: $ make octocat 66 ./octocat - make is a tool that automates compiling complex projects. For a simple, one-file project it runs $cc octocat. c-o octocat for you. - The &s operator is a Bash built-in command. It runs the second command only if the first command was successful. This is a good way to compile-run-test efficiently. - You can read about it here: https://www.gnu.org/savannah-checkouts/gnu/bash/ manual/bash.html\#Lists - Open 2 terminal windows: One to edit. The other to compile-and-test. Often, I have a 3rd open for research

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!