fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. rowFn(0,5);
  14. }
  15.  
  16. public static void rowFn(int rowNo, int n){
  17.  
  18. if(rowNo == n){
  19. return;
  20. }
  21. else {
  22. System.out.println(columnFn(rowNo));
  23. rowFn(rowNo+1,n);
  24. }
  25.  
  26. }
  27.  
  28. public static String columnFn(int columnNo) {
  29.  
  30. if(columnNo == 0){
  31. return "*";
  32. }
  33. else {
  34. return "* "+columnFn(columnNo - 1);
  35. }
  36.  
  37. }
  38.  
  39.  
  40. }
Success #stdin #stdout 0.15s 55484KB
stdin
Standard input is empty
stdout
*
* *
* * *
* * * *
* * * * *