Advertisement
Guest User

[SCHOOL][PXL] OefsubroutineDriehoek

a guest
Oct 24th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public class Oef_subroutine_2 {
  2.  
  3.         static void tekenDriehoek (int h, char symb) {
  4.             for (int i = 1; i <= h; i++) {
  5.                 for (int k = 0; k < h-i; k++) {
  6.                     System.out.print("  ");
  7.                 }
  8.                 for (int j = 0; j < i; j++) {
  9.                         System.out.print(symb);
  10.                         System.out.print(" "); //spaties tussen ieder teken
  11.                 }
  12.                 System.out.println("");
  13.             }
  14.         }
  15.         public static void main (String[] args) {
  16.                 int hoogte;
  17.                 char symbool;
  18.                 hoogte= Invoer.leesInt("Geef het aantal regels in");
  19.                 symbool= Invoer.leesChar("Geef het symbool in");
  20.                 tekenDriehoek(hoogte, symbool);
  21.         }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement