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
Sedbober [7]
4 years ago
10

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:
stiks02 [169]4 years ago
5 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
What does anyone who chooses to use speech recognition software need to do?
skelet666 [1.2K]
D I believe. I’m not %100 percent sure.
4 0
3 years ago
Who is the first computer programmer​
enot [183]

Answer:

Ada Lovelace was the first computer programmer

8 0
2 years ago
Read 2 more answers
When evaluating the validity of a website beyond its URL, you can practice the "rule of 3" which means
Schach [20]

Any information on a website should be findable within 3 mouse clicks.

5 0
3 years ago
Read 2 more answers
Sino ang pinaka matalino sa math sa buong mundo​
Svetllana [295]

Answer:

lahat ng tao ay matalino kasama ka na dun kaya lang di natin ito inilalabas dahil natatamad tayo

6 0
3 years ago
Read 2 more answers
John is considering his STEM education choices. He wants to begin working in the technology field as soon as possible.
wariber [46]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

STEM is a curriculum based on the idea of educating students in four specific disciplines — science, technology, engineering,  and mathematics — in an interdisciplinary and applied approach. The students who graduated in STEM-based education getting more paid and jobs than students who did not study the STEM-based education.

As in this question that John is considering his STEM education choices, and he wants to begin working in the technology field as soon as possible. He should pursue bachelor (graduate) degree in technology. Because after, passing out, he can begin working in technology easily.

5 0
3 years ago
Other questions:
  • How is a correction made to an Electronic health record?
    14·1 answer
  • Your mom wants to purchase a computer. She has heard about how the Windows 8 operating system is best-geared for a touch-enabled
    10·2 answers
  • What was the process called that required the photographer to have a tent or darkroom handy so that chemicals could be mixed qui
    7·1 answer
  • I keep getting this error: postfix.cpp: In function ‘double RPN_evaluation(std::string)’: postfix.cpp:42:26: error: cannot conve
    7·1 answer
  • For example, consider a file with protection mode 644 (octal) contained in a directory with protection mode 730. How might the f
    9·1 answer
  • 75+ (43-54)<br> -12<br> 12<br> 41
    12·2 answers
  • 2. The Internet could best be described as: *
    12·1 answer
  • Learning Task 3: Write the safety requirement indicated in each number on a
    15·1 answer
  • Which is the correct option?
    6·1 answer
  • Write 2 paragraphs. 1 comparing Shrek the movie and Shrek the musical and another contrasting them.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!