Advertisement
AlexanderF

P1W1 oef driehoek & extremen

Sep 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. DRIEHOEK
  2. ____________
  3. package driehoek;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class driehoek {
  8.     public static void main(String[] args){
  9.         int hoogte;
  10.         int i=0;
  11.         int j=0;
  12.         Scanner keyboard = new Scanner(System.in);
  13.  
  14.         System.out.print("Geef de hoogte van je driehoek in: ");
  15.         hoogte = keyboard.nextInt();
  16.         while(i<=hoogte)
  17.         {
  18.             while(j<i)
  19.             {
  20.                 System.out.print("42 ");
  21.                 j++;
  22.             }
  23.             System.out.println();
  24.             i++;
  25.             j = 0;
  26.         }
  27.  
  28.  
  29.     }
  30. }
  31.  
  32.  
  33. EXTREMEN
  34. ___________
  35. package extremen;
  36.  
  37. import java.util.Scanner;
  38.  
  39. public class extremen {
  40.     public static void main(String[] args){
  41.         int kleinste;
  42.         int grootste;
  43.         int input;
  44.         Scanner keyboard = new Scanner(System.in);
  45.  
  46.         System.out.print("Geef je getal in, type -1 om te stoppen.");
  47.         input = keyboard.nextInt();
  48.         kleinste = input;
  49.         grootste = input;
  50.  
  51.         while(input!= -1)
  52.         {
  53.             if(input<kleinste)
  54.             {
  55.                 kleinste = input;
  56.             }
  57.             if(input>grootste)
  58.             {
  59.                 grootste = input;
  60.             }
  61.             input = keyboard.nextInt();
  62.         }
  63.         System.out.print("Uw grootste getal was:" + grootste);
  64.         System.out.println();
  65.         System.out.print("Uw kleinste getal was:" + kleinste);
  66.  
  67.  
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement