Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //oef 2
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int getallen[] = new int[10];
- for(int i = 0; i <=9;i++){
- System.out.println("Geef getal " + (i + 1)+ ": ");
- getallen [i]=s.nextInt();
- }
- System.out.println("Geef nog en getal in: ");
- int waarde = s.nextInt();
- System.out.println("\tindex\twaarde");
- for(int i = 0; i<=9; i++){
- if(getallen[i]>waarde){
- System.out.println("\t" + i + "\t" + getallen[i]);
- }
- }
- }
- //oef 3
- public static void main(String[] args) {
- int getallen[] = {360,2100,450,1450,650,780,321,1200,560,1850,960,420};
- int laagste = getallen[0];
- int maandl = 0;
- int hoogste = getallen[0];
- int maandh = 0;
- for(int i=0; i<=11; i++){
- if(getallen[i]<laagste){
- laagste = getallen[i];
- maandl = i;
- }
- if(getallen[i]>hoogste){
- hoogste = getallen[i];
- maandh = i;
- }
- }
- System.out.println("laagste: " + laagste + "in de maand " + (maandl + 1));
- System.out.println("hoogste: " + hoogste + "in de maand " + (maandh + 1));
- }
- //oef 4
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- double table [][]= new double[3][2];
- int total = 0;
- for(int i=0; i<=2;i++){
- for(int j=0; j<=1;j++){
- System.out.println("geef een getal voor rij " + i + " kolom " + j + ": ");
- double temp = s.nextDouble();
- table[i][j] = temp;
- total += temp;
- }
- }
- System.out.println("Gemiddelde = " + (total/6));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement