Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class KymmenVuotta2 {
  3. static Scanner scan = new Scanner (System.in);
  4. public static void main(String[] args) {
  5.  
  6.  
  7.  
  8.  
  9. final int LKM=5;
  10. int []vuodet={};
  11. vuodet = new int[LKM];
  12. int i;
  13.  
  14.  
  15.  
  16.  
  17. for (i=0;i<vuodet.length; i++){
  18. System.out.println("Anna vuosiluku: ");
  19. vuodet [i] = scan.nextInt();
  20. }
  21. int aikaisempi = vuodet[1];
  22. int ind = 0;
  23. while (ind < LKM){
  24. System.out.println(vuodet[ind]);
  25. if (vuodet[ind]<aikaisempi){
  26. aikaisempi = vuodet[ind];
  27. }
  28. ind++;
  29. }
  30. System.out.println("Aikaisin vuosi: "+aikaisempi);
  31.  
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement