We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
A small change in your code to make it more simple
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String str="#";
for (int i=0;i<n;i++)
{
System.out.printf("%"+n+"s%n",str);
str=str+"#";
}
}
Staircase
You are viewing a single comment's thread. Return to all comments →
A small change in your code to make it more simple
public class Solution {
}