Write a function that takes in an integer n and prints out a

Write a function that takes in an integer n and prints out a staircase to the console like this (for n=4): It should be able to handle any n up to 50. If n is greater than 50, the function should print the string \"Not available\". Read the following on arrays http://www.w3schools.com/js/js_arrays.asp. Write a function that takes an array of integers, and a positive integer, n. The function finds the number of pairs (i, j) in the array where i

Solution

import java.io.*;
import java.util.*;

public class Test {

public static void main(String[] args) {
  
int num = 2;
for(int j=0;j<num;j++){
for(int i=1;i<=num;i++){
System.out.print(i<num-j?\" \":\"#\");
}
System.out.println(\"\");
}
  
}
}

 Write a function that takes in an integer n and prints out a staircase to the console like this (for n=4): It should be able to handle any n up to 50. If n is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site