Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class aceitararray10oumenos {
  3.         static int []tab;
  4.         public static void main(String[] args){
  5.             tab=new int [10];
  6.             int notas,contador, melhor,i;
  7.             notas=0;
  8.             contador=0;
  9.             melhor=0;
  10.             Scanner leitor;
  11.             leitor=new Scanner(System.in);
  12.                 for (i=0; i<10; i=i+1){
  13.                     while(contador<10){
  14.                         System.out.print("Introduza as notas:");
  15.                         tab[i]=leitor.nextInt();
  16.                     if (tab[i]==999){
  17.                         tab[i]=0;
  18.                                     }
  19.                     if (tab[i]>=melhor){
  20.                         melhor=tab[i];
  21.                                         }  
  22.                 contador=contador+1;
  23.                                         }       }
  24.             System.out.println("Melhor nota:" + melhor);
  25.                                                 }                                          
  26.                                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement