Guest User

Untitled

a guest
Apr 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import acm.program.*;
  2.  
  3. public class Askisi2 extends Program {
  4.  
  5. public void run() {
  6. int n = readInt("Enter tne size of triangle: ");
  7. println("The triangle is: ");
  8. subthetiko(n);
  9. }
  10.  
  11.  
  12. String subthetiko(int n)
  13. {
  14. if (n==0)
  15. {
  16. return "\n" ;
  17. }
  18. else
  19. {
  20. String z = subthetiko(n - 1) + "*";
  21. println( z + "\n" );
  22. return z;
  23. }
  24.  
  25. }
  26.  
  27. }
Add Comment
Please, Sign In to add comment