Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DRIEHOEK
- ____________
- package driehoek;
- import java.util.Scanner;
- public class driehoek {
- public static void main(String[] args){
- int hoogte;
- int i=0;
- int j=0;
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Geef de hoogte van je driehoek in: ");
- hoogte = keyboard.nextInt();
- while(i<=hoogte)
- {
- while(j<i)
- {
- System.out.print("42 ");
- j++;
- }
- System.out.println();
- i++;
- j = 0;
- }
- }
- }
- EXTREMEN
- ___________
- package extremen;
- import java.util.Scanner;
- public class extremen {
- public static void main(String[] args){
- int kleinste;
- int grootste;
- int input;
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Geef je getal in, type -1 om te stoppen.");
- input = keyboard.nextInt();
- kleinste = input;
- grootste = input;
- while(input!= -1)
- {
- if(input<kleinste)
- {
- kleinste = input;
- }
- if(input>grootste)
- {
- grootste = input;
- }
- input = keyboard.nextInt();
- }
- System.out.print("Uw grootste getal was:" + grootste);
- System.out.println();
- System.out.print("Uw kleinste getal was:" + kleinste);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement