Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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 quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Errors uncovered during work to make change, Echange.

Answered: 1 week ago

Question

Assess various approaches to understanding performance at work

Answered: 1 week ago

Question

Provide a model of performance management

Answered: 1 week ago