Answers for "System.out.println(n+" * "+i+" = "+n*i);"

0

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

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 \n", str);
			str += "#";
		}
		in.close();
	}
}
Posted by: Guest on October-16-2020
0

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

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 \n", str);
			str += "#";
		}
		in.close();
	}
}
Posted by: Guest on October-16-2020

Code answers related to "System.out.println(n+" * "+i+" = "+n*i);"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language