Advertisement
KeeJayBe

H7 theorie oefeningen

Nov 14th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.89 KB | None | 0 0
  1. //oef 2
  2.  
  3. public static void main(String[] args) {
  4.         Scanner s = new Scanner(System.in);
  5.         int getallen[]  = new int[10];
  6.        
  7.         for(int i = 0; i <=9;i++){
  8.             System.out.println("Geef getal " + (i + 1)+ ": ");
  9.             getallen [i]=s.nextInt();
  10.         }
  11.        
  12.         System.out.println("Geef nog en getal in: ");
  13.         int waarde = s.nextInt();
  14.         System.out.println("\tindex\twaarde");
  15.                
  16.                
  17.         for(int i = 0; i<=9; i++){
  18.            if(getallen[i]>waarde){
  19.                System.out.println("\t" + i + "\t" + getallen[i]);
  20.            }
  21.         }
  22.     }
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. //oef 3
  31.  
  32. public static void main(String[] args) {
  33.         int getallen[] = {360,2100,450,1450,650,780,321,1200,560,1850,960,420};
  34.         int laagste = getallen[0];
  35.         int maandl = 0;
  36.         int hoogste = getallen[0];
  37.         int maandh = 0;
  38.         for(int i=0; i<=11; i++){
  39.             if(getallen[i]<laagste){
  40.                 laagste = getallen[i];
  41.                 maandl = i;
  42.             }
  43.             if(getallen[i]>hoogste){
  44.                 hoogste = getallen[i];
  45.                 maandh = i;
  46.             }
  47.         }
  48.         System.out.println("laagste: " + laagste + "in de maand " + (maandl + 1));
  49.         System.out.println("hoogste: " + hoogste + "in de maand " + (maandh + 1));
  50.     }
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59. //oef 4
  60.  
  61. public static void main(String[] args) {
  62.         Scanner s = new Scanner(System.in);
  63.         double table [][]= new double[3][2];
  64.         int total = 0;
  65.         for(int i=0; i<=2;i++){
  66.             for(int j=0; j<=1;j++){
  67.                 System.out.println("geef een getal voor rij " + i + " kolom " + j + ": ");
  68.                 double temp = s.nextDouble();
  69.                 table[i][j] = temp;
  70.                 total += temp;
  71.             }
  72.         }
  73.         System.out.println("Gemiddelde = " + (total/6));
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement