Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using the command ' rem ' write a program that request a positive interger as input and then follows this procedure; if the number is

using the command ' rem '
write a program that request a positive interger as input and then follows this procedure; if the number is even, divide it by 2. if not, multiply the number by 3 and the add 1.
repeat this process with the resulting number and continue repeating until the 1 is reached. After the 1 is reached, the program should display the number of iterations required to reach the number 1. when the program requests input, it should check that the user inputs a positive integer greater than 1. if not, an error message should be generated.

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions