Advertisement
Guest User

Untitled

a guest
Dec 10th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. int[] grades=new int[10];
  2. int i = 1;
  3.  
  4. Scanner scan=new Scanner(System.in);
  5. System.out.println("please enter grades");
  6.  
  7. grades[0]=scan.nextInt();
  8. int big = grades[0];
  9. int small = grades[0];
  10.  
  11. while(i<10)
  12. {
  13.  
  14. grades[i]=scan.nextInt();
  15.  
  16. if(grades[i]>big){
  17. big=grades[i];
  18. }
  19.  
  20. if(grades[i]<small){
  21. small=grades[i];
  22. }
  23.  
  24. i++;
  25.  
  26. }
  27.  
  28. scan.close();
  29.  
  30. System.out.println("the big is "+big);
  31. System.out.println("the small is "+small);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement