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
DaniilM [7]
3 years ago
15

1. Write an application that prompts the user to enter the size of the side of a square, and then displays a hollow square of th

at size made of asterisks. Your program should work for squares of all side lengths between 1 and 20. This is a sample run of your program: Enter·the·size·of·the·asterisk·square·from·1-20:3↵ ***↵ *·*↵ ***↵
Computers and Technology
1 answer:
belka [17]3 years ago
4 0

Answer:

import java.util.Scanner;

public class HollowSquare

{

public static void main(String args[])

{

Scanner scan = new Scanner(System.in);

int size;

System.out.print("Enter the size : ");

size = scan.nextInt();

if(size>=1 && size<=20)

{

for(int i=0; i<size; i++)

{

for(int j=0; j<size; j++)

{

if(i==0 || j==0 || i==size-1 || j==size-1)

System.out.print("*");

else

System.out.print(" ");

}

System.out.println();

}

}

else

System.out.println("Invalid size.");

}

}

You might be interested in
How many comparisons will be done to find 8 in this list using a linear search?
Margaret [11]

Answer:

I think 4 comparisons

8 0
3 years ago
Write an algorithm to sum to values
Elis [28]

Answer:

There is no need to make an algorithm for this simple problem. Just add the two numbers by storing in two different variables as follows:

Let a,b be two numbers.

c=a+b;

print(c);

But, if you want to find the sum of more numbers, you can use any loop like for, while or do-while as follows:

Let a be the variable where the input numbers are stored.

while(f==1)

{

printf(“Enter number”);

scanf(“Take number into the variable a”);

sum=sum+a;

printf(“Do you want to enter more numbers? 1 for yes, 0 for no”);

scanf(“Take the input into the variable f”);

}

print(Sum)

Explanation:

hi there answer is given mar me as brainliest

5 0
3 years ago
A ____________________ can be used to hierarchically represent a classification for a given set of objects or documents. A. taxo
neonofarm [45]

Answer:

A. taxonomy

Explanation:

A taxonomy can be used to hierarchically represent a classification for a given set of objects or documents.

3 0
4 years ago
How do i cancel my brainly premium account?
Vikki [24]

Answer:

press cancel

Explanation:

5 0
3 years ago
Read 2 more answers
What is the information age?
Sergio [31]
The Information Age<span> (also known as the Computer </span>Age<span>, Digital </span>Age, or New Media Age<span>) is a period in human history characterized by the shift from traditional industry that the Industrial Revolution brought through industrialization, to an economy based on </span>information<span> computerization.</span>
4 0
3 years ago
Other questions:
  • A ____ is a prewritten formula that is built into excel.
    6·1 answer
  • If a class has member variables that are pointers, you must ensure that you implement ____.
    6·1 answer
  • Web pages with personal or biograpic information are called ​
    10·1 answer
  • Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output param
    11·1 answer
  • What is TCP/IP's Transport layer's primary duty?
    8·1 answer
  • Using an LCD projector to show an online video to a group of people is an example of:
    14·1 answer
  • When you catch an Exception object, you can call ____ to display a list of methods in the call stack so you can determine the lo
    6·1 answer
  • Write a method named removeRange that accepts an ArrayList of integers and two integer values min and max as parameters and remo
    10·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
  • Heyyyyyy who likes anime​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!