subject

Write a function "hailstone"that takes an int "n2"and prints the hailstone sequence. Hailstone Numbers:This sequence takes the name hailstone as the numbers generated bounce up and down. To generate the sequence, follow these rules:a. If the number isodd multiply it by 3 and add 1 b. If the number is even, divide by two. c.Repeat until you reach number 1.Sample Inputs & Outputsn2= 3-> 10, 5, 16, 8, 4, 2, 1 n2 =6-> 3, 10, 5, 16, 8, 4, 2, 1 n2 =7-> 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, willwhitlock803
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
image
Computers and Technology, 22.06.2019 08:00, razielcornils04
What is the algorithm for building a binary tree program
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, elsauceomotho
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, puppylove899
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a. an advanced knowledge of physics and math b. an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
You know the right answer?
Write a function "hailstone"that takes an int "n2"and prints the hailstone sequence. Hailstone Numbe...

Questions in other subjects: