Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C language Due date: 02-27-2019 (W), 9pm If you pass the first 4 tests on zyBook, another week will be given for corrections and

image text in transcribedimage text in transcribed

In C language

Due date: 02-27-2019 (W), 9pm If you pass the first 4 tests on zyBook, another week will be given for corrections and improvements after the grader finishes grading and giving feedback. Resubmission needs to be done on Blackboard too Submission: a C file (program1.c), up to 20 times on zyBooks Points: 50 Points Requirements 25 10 Pass the test cases on zyBooks Proper use of functions Students should write at least one user-defined function (except of clear_keyboard_buffer) Variables should be local, but not global ones; reasonable loop structure Use meaningful names for variables and functions Sufficient Comments in the program. Should have comments for vour functions Indentation should indicate Proper use of variables, program structures Programming Style (the graders will check the ones listed on the right column, but not limited to those ram structure Program Comments Header (name, purpose of assignment, etc Description According to Wikipedia: The Collatz conjecture is a coniecture in mathematics named after Lothar Collatz, who first proposed it in 1937. The conjecture is also known as the 3n 1 conjecture the Ulam conjecture (after Stanistaw Ulam), Kakutani's problem (after Shizuo Kakutani), the Thwaites conjecture (after Sir Bryan Thwaites), Hasse's algorithm (after Helmut Hasse), or the Syracuse problem,2the sequence of numbers involved is referred to as the hailstone sequence or hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as wondrous numbers TH n Thwaites),Hasse's algorithma Take any natural number n. If n is even, divide it by 2 to get n/2. If n is odd, multiply it by 3 and add 1 to obtain 3n+1. Repeat the process (which has been called "Half Or Triple Plus One", or HOTPO indefinitely. The conjecture is that no matter what number you start with, you will always eventually reach 1. The property has also been called oneness. Program1 should create a table of numbers providing information about the number of steps that a particular number takes in order to reach the number 1 in the sequence described above. Your program should create the table by first asking the user to enter a starting integer larger than 1 (1) and less than 100 (ONE HUNDRED) and then an ending number that is greater than their starting number and less than 1,000 (ONE THOUSAND). For every integer in between, and including the start and end points, your program should compute the number of steps it takes to reach the number 1 and display it beside the original number. A sample run with the starting point of 2 and the ending point of 99 is given below Run my program Stop Clear terminal Enter a starting points Enter an ending point 3:7 13 9 14 17 15117 17 12 27 111 34 13 55 112 63 107 71:102 79:35 86:30 93:17 73:115 80:9 87:30 94 105 74:22 81:22 80:17 95:105 82:110 89:30 96:12 83:110 90:17 97:118 77:22 84:9 91:92 90:25 85:9 92:17 99:25 Your program should print a maximum of 7 columns per line where each column follows the following format rules: The first number is printed right justified in 5 spaces then a colon is printed then the number of steps is written as a left justified number in 5 spaces. The end result is that we get columns centered on the colon character as shown in the screenshot. Here are some tips to help you start the program. First, think about what tasks you need to do in this assignment. For example, after reading the assignment,I can think of several tasks, e.g., read a valid starting point and a valid ending point; calculate the steps for each number to get 1; format the output as required. Write those tasks down, yours might not be the same of mine, but put as many details as possible. Second, think about what you need to do in order to finish each task. Use examples to go through the process manually, e.g., why it takes 7 steps for 3 to go to 1. You may also think about what program structure may help you to achieve the goal. Write more details for each task. Then you may start to write code, but little by little, test each task before you move into the next one. You may find yourself go back and forth between these 3 steps from time to time and that is totally normal. You should make good use of functions to make your code easy to read. Please use at least one user-defined function (except of the clear keyboard buffer function) to write your program. Please start early and don't wait till 1"2 days before the due date to start

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

Step: 3

blur-text-image

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Let Y1 Answered: 1 week ago

Answered: 1 week ago

Question

- What comes to mind when you think about postponing the agreement?

Answered: 1 week ago

Question

3. Describe the strategic training and development process.

Answered: 1 week ago

Question

10. Microsoft Corporation

Answered: 1 week ago