ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 May 2017 My Price 8.00

Write a C program where the user will enter the starting number

Part A: The Collatz conjecture concerns what happens when we take any positive integer n and apply the following algorithm:

 

if n is even number then n = n/2 and if n is odd number then n = 3 * n+1

 

The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1. For example, if n = 35, the sequence is

35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1 (35 is an odd number so 3 * 35 +1 = 106, 106 is an even number so 106 /2 = 53, so on...)

Write a C program where the user will enter the starting number. For example, if 8 is passed as a parameter on the command line, the output will be 8, 4, 2, 1. The program should accept any arbitrary integer typed in by the user. You should keep excepting user entry until the user types in a negative number (i.e. -1 or -2.) and display the output. -- 

 

Part B: The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it. Write a program that will print the first 25 number of the Fibonacci series. -

 

Answers

(11)
Status NEW Posted 26 May 2017 07:05 AM My Price 8.00

-----------

Not Rated(0)