Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

System.out.printf("%"+(n)+"s ")

public class Staircase {
	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 
", str);
			str += "#";
		}
		in.close();
	}
}
Source by www.kodnest.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+4 =