Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me solving this question: USE PRINTF and SCANF if you can. we usually do it in visual studio. Write a program to implement
Please help me solving this question: USE PRINTF and SCANF if you can.
we usually do it in visual studio.
Write a program to implement a convergence algorithm Prompt the user and enter an integer between 5 and 25. Use a while validation loop to assure the integer is in the specified range (between 5 and 25 inclusive). While the integer is out of the proper range, prompt the user to re-enter the number. Use a while loop to implement the convergence algorithm, starting with the integer entered. On each pass through the while loop check to see if the number is odd or even. If odd, multiply the number by 3 and add 1. If even, divide by 2. Print the value of the number on each pass through the loop. Continue iterating until the number converges to 1. Note: This algorithm will always converge to 1. When the program is working, modify it using a while or do...while loop so that the program will continue prompting the user to see if the program is to be run again with a different integer. After the convergence algorithm is completed the user will be asked if he wants to choose a different integer for the convergence test. He might enter Y to continue or N to quitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started