subject

Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an / 2 if an is even; an+1 = 3 x an + 1 if an is odd. then there exists an integer k such that ak = 1. instructions write a program that prompts the user to input the value of x. the program outputs: the numbers a0, a1, a2, . . , ak. the integer k such that ak = 1 (for example, if x = 75, then k = 14, and the numbers a0, a1, a2, a14, respectively, are 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1.) test your program for the following values of x: 75, 111, 678, 732, 873, 2048, and 65535.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
Kyle wants to access his school’s home page. how can he do this?
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 23.06.2019 03:10
Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the buy one get one sale.#include //main functionint main() { int cartons; float price, total; //prompt user for input information printf("what is the cost of one container of oj in dollars? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & price); printf("how many containers are you buying? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & cartons); if ( [ select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ select ] ["=", "==", "! =", "< =", "> =", "< "] 0) total = [ select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price; printf("the total cost is $%.2f.\n", total); return 0; }
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the β€œ married filing jointly β€œ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
You know the right answer?
Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an...
Questions
question
Spanish, 22.07.2019 10:30
Questions on the website: 13722363