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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
Does read theory have answers keys ?
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
You know the right answer?
Write a function "hailstone"that takes an int "n2"and prints the hailstone sequence. Hailstone Numbe...
Questions
question
Mathematics, 12.02.2021 14:00
question
Engineering, 12.02.2021 14:00
question
Mathematics, 12.02.2021 14:00
question
Mathematics, 12.02.2021 14:00
question
Mathematics, 12.02.2021 14:00
question
Mathematics, 12.02.2021 14:00
question
Mathematics, 12.02.2021 14:00
Questions on the website: 13722359