C programming

Problem: Given the starting and ending integers representing a range of numbers, count the number of integers in that range, inclusive of the endpoints, which are a part of the Fibonacci sequence of numbers.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

 

Example Execution #1:

Enter the starting value: 2

Enter the ending value: 22

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Total number in range: 6

CS 159 – HW #06
5 Points Possible
Due: July 23, 2012 at 11:00pm.

Problem: Given the starting and ending integers representing a range of numbers, count the number of integers in that
range, inclusive of the endpoints, which are a part of the Fibonacci sequence of numbers.

• Hint: The topic of Fibonacci Numbers is discussed in chapter 6 of your C programming text (page 354). You
may make use of code found in the text assuming that you: (1) reference your source in the user-defined function
course header (head_fx) and (2) bring all code up to course standards.

Example Execution #1:

Enter the starting value: 2
Enter the ending value: 22
Total number in range: 6

Example Execution #2:

Enter the starting value: 2
Enter the ending value: 100
Total number in range: 9

Example Execution #3:

Enter the starting value: 4
Enter the ending value: 49
Total number in range: 5

Example Execution #4:

Enter the starting value: 1

Error! Minimum starting value is 2!!

Enter the starting value: 5
Enter the ending value: 4

Error! Ending value must be >= 5

Enter the ending value: 12
Total number in range: 2

Example Execution #5:

Enter the starting value: 99
Enter the ending value: 105
Total number in range: 0

Additional Requirements:

1. Accept input and produce output exactly as seen in the example executions.
◦ The only input validation required in this assignment is demonstrated in the example executions.
◦ Your program will not be tested with values larger than 1,000,000.

2. You MUST make good use of user-defined functions! Failing to meet this requirement will result in a zero
for the assignment.
◦ Recall what is acceptable in a main function and those tasks that must be factored into user-defined

functions.
◦ Tasks such as input, output, and calculations should be delegated to functions and should not be left inside of

the main function.
3. DO NOT use any material found outside of the first SIX chapters of the C text.
4. DO NOT make use of control-forcing statements such as exit, break, continue, or multiple return statements

inside of single function.
5. Variables with global scope are never permitted in an assignment.
6. A program must compile to be considered for partial credit.

Academic Integrity Reminder:

• Please review the policies of the course as they relate to academic integrity. The assignment you submit should be
your own original work. You should be consulting only course staff regarding your specific algorithm for
assistance. Collaboration is not permitted on individual homework assignments.

Course Programming and Documentation Standards Reminders:

• Use the course function header (head_fx) for every user-defined function in your program.
◦ List and comment all parameters to a function, one per line, in the course function header.
◦ All function declarations will appear in the global declaration section of your program.
◦ The user-defined function definitions will appear in your program after main and can be in any order.

• Make good use of symbolic constants and minimize your use of literal constants.
• Place a single space between all operators and operands.
• Comment all variables to the right of each declaration. Declare only one variable per line.
• Do not permit your local declaration and executable statement sections to overlap in a function!
• Select meaningful identifiers (names) for all variables and functions in your program.
• Indent all code found within the main and all user-defined functions exactly two spaces.

◦ And indent all code found inside of selection and repetition constructs (those with a body, all code between
{ and }) two additional spaces.

• Do not single (or double) space the entire program, use blank lines when appropriate.

When you submit… only the last attempt of a submission is kept for grading. All other submissions are over-written and
cannot be recovered. You may make multiple submissions but only the last attempt is retained and graded.

• Verify in the e-mail sent to you by the course that you have submitted the correct file, to the correct assignment
(hw06), and to the correct lab section. Forwarding course e-mails from Purdue to external e-mail services may
result in the mail being undelivered or end up being identified as spam.

• Leave time prior to the due date to seek assistance should you experience difficulties completing or submitting
this assignment.

• All attempts to submit via a method other than through the sage server as set up during the first week of the
semester will be denied consideration. (Reference: http://goo.gl/dMm4i)

Assignment deadlines… are firm and the electronic submission will disable promptly as advertised. We can only grade
what you submit as expected (including the correct assignment and lab section) prior to the assignment deadline.

All course programming and documentation standards are in effect for this and each
assignment this semester. Please review this document in your course notes packet.

http://goo.gl/dMm4i

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER