Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that keeps reading an integer until a positive value is entered. The program repeatedly displays half of the number until it

 

Write a program that keeps reading an integer until a positive value is entered. The program repeatedly displays half of the number until it becomes 1. Sample Run 1: Enter a positive integer: -2 Enter a positive integer: -4 Enter a positive integer: -92 Enter a positive integer: -34 Enter a positive integer: -12 Enter a positive integer: 38 Displaying halves starting from 38: 38 19 9 4 2 1 Java langauge

Step by Step Solution

3.31 Rating (169 Votes )

There are 3 Steps involved in it

Step: 1

Here is the code import javaio import java... 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_2

Step: 3

blur-text-image_3

Document Format ( 2 attachments)

PDF file Icon
63617ce7891a6_235820.pdf

180 KBs PDF File

Word file Icon
63617ce7891a6_235820.docx

120 KBs Word File

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

Java Concepts Late Objects

Authors: Cay S. Horstmann

3rd Edition

1119186714, 978-1119186717

More Books

Students also viewed these Programming questions

Question

What courses does he/she teach?

Answered: 1 week ago

Question

=+a randomly selected cork will conform to specification?

Answered: 1 week ago