1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BabaBlast [244]
4 years ago
7

Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has

already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j.
Computers and Technology
1 answer:
emmasim [6.3K]4 years ago
6 0

Answer:

The solution code is written in Java.

  1. public class Main {
  2.    public static void main(String[] args) {
  3.        int n = 5;
  4.        int j;
  5.        do{
  6.            System.out.print("*");
  7.            n--;
  8.        }while(n > 0);
  9.    }
  10. }

Explanation:

Firstly, declare the variable n and assign it with value 5 (Line 4). Next declare another variable j.

Next, we create a do while loop to print the n-number of asterisks in one line using print method. In each iteration one "*" will be printed and proceed to the next iteration to print another "*" till the end of the loop. This is important to decrement the n by one before the end of a loop (Line 9) to ensure the loop will only run for n times.

You might be interested in
HELP I WILL GIVVE BRAINLY AND 15 POINTS
levacccp [35]

Answer:

Because someone was hittting the space bar in the message instead of typing letters and numbers

Explanation:

Because they were bored or it was a glitch

4 0
3 years ago
An engineer has reported that a printer is no longer working and needs troubleshooting. You have been informed that there is a p
gavmur [86]

Answer:

3D Printer.

extruders are in 3D printers.

7 0
2 years ago
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0,
TEA [102]

Answer:

ranforce = randi([0, 12]);

if (ranforce == 0)

     disp('There is no wind')

else  if(ranforce>0 && ranforce <7)

     disp('There is a breeze')

else  if(ranforce>6 && ranforce <10)

     disp('This is a gale')

else  if(ranforce>9 && ranforce <12)

     disp('It is a storm')

else  if(ranforce==12)

     disp('Hello, Hurricane!')

end

Explanation:

<em>Replace all switch case statements with if and else if statements.</em>

<em>An instance is:</em>

<em>case {7,8,9}</em>

<em>is replaced with</em>

<em>else  if(ranforce>9 && ranforce <12)</em>

<em>All other disp statements remain unchanged</em>

5 0
3 years ago
Hypertension occurs when blood pressure is too high.
Ivan
True, hypertension is when your blood pressure is to high.
Please mark as brainliest
8 0
3 years ago
Choose the correct comparison statement about delivery and read receipts.
Lostsunrise [7]

Answer:

A: Delivery receipts can be enabled for all messages, while read receipts can be turned off by the recipient.

5 0
3 years ago
Other questions:
  • Savings accounts typically offer more interest than what
    10·1 answer
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • Mr. Olgesandravich is proctoring students working at their own pace in an online class. He is generating a spreadsheet that show
    15·1 answer
  • All java classes must contain a main method which is the first method executed when the java class is called upon.
    10·1 answer
  • What is looping in QBASIC​
    9·1 answer
  • ​______________________ is a general security term that includes computer​ viruses, worms, and trojan horses.
    13·1 answer
  • In networking, bandwidth is the volume of computer data carried via a conductor in a period of time. Which one of these could be
    11·1 answer
  • If you were looking for a record in a very large database and you knew the ID number, which of the following would be the most d
    6·1 answer
  • Copy the skeleton of code below into your answer. Then in the space indicated, add your own code to prompt the user for two numb
    8·1 answer
  • The three main objectives of information security are.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!