Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (3 points) Consider the following method: public static void countDown(int n) { for (int count = n; count >= 1; count--) { System.out.println(count); }

image text in transcribed

2. (3 points) Consider the following method: public static void countDown(int n) { for (int count = n; count >= 1; count--) { System.out.println(count); } } When the input n is a positive integer, this method "counts down" from n, printing the integers from n down to 1. For example, countDown(5) would print 5 4 3 2 1 If n is less than or equal to 0, the method does not print anything. We have included the original method in ps1_partI. Rewrite it so that it uses a while loop instead of a for loop

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

=+j Enabling a productive global workforce.

Answered: 1 week ago

Question

=+ Are you interested in creating or

Answered: 1 week ago