In this task, you have to print n
stars *
vertically and n
horizontally. You are given functions to complete. Donot worry about the input and ouput of functions just print n
vertical stars in vertical and n
horizontal stars in horizontal.
Note
Your task is to complete the functions verticalN() and horizontalN() given to print the stars.
Input Format
The first line of input contains n
.
Output Format
print the stars in horizontal and vertical direction.
Example 1
Input
3
Output

Exaplantion
We print the 3 stars in horizontal and 3 stars vertical direction.
Example 2
Input
5
Output

Exaplantion
We print the 5 stars in horizontal and 5 stars vertical direction.
Constraints
1<= n <= 100
Solution of N Stars Functions in java:–
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { //your code here for(int i=0;i<7;i++) { if(i==0) { for(int p=0;p<4;p++) { System.out.print("*"+" "); } } else { System.out.println("*"); } } } }
Add a Comment