Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago