Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume we have defined a variable variable of type int called numSpaces with the following line of code: int numSpaces = ???; // numAsterisks can
Assume we have defined a variable variable of type int called numSpaces with the following line of code:
int numSpaces = ???; // numAsterisks can have any value
TASK: Print out two asterisks(i.e. the character '*'), with numSpaces empty spaces in between. In other words:
- Print a single asterisk
- Print an empty space exactly numSpaces times
- Print a single asterisk
EXAMPLE: If numSpaces is 5, you would print the following:
* *
NOTE: You do not need to create a class or a main method. We have done that behind the scenes.
Sample Input 1:
5
Sample Output 1:
* *
Sample Input 2:
8
Sample Output 2:
* *
PLEASE ANSWER IN JAVA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started