daniel_lawson9999

javatestquestion18

Apr 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class Question18 {
  2. public static void main(String[] args) {
  3.  
  4. printDesign();
  5. }
  6.  
  7. public static void printDesign() {
  8. for (int lines = 1; lines <= 5; lines++) {
  9. for (int dashes = 1; dashes <= lines * -1 + 6; dashes++) {
  10. System.out.print("-");
  11. }
  12.  
  13. for (int numbers = 1; numbers <= lines * 2 - 1; numbers++) {
  14. System.out.print((lines * 2) - 1);
  15. }
  16.  
  17. for (int dashes = 1; dashes <= lines * -1 + 6; dashes++) {
  18. System.out.print("-");
  19. }
  20. System.out.println();
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment