(URI) Números Positivos - Solução

import java.io.*;

class Main {
    public void processa() throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       
        int countPositives = 0;
       
        for (int i = 0; i < 6; i++) {
            double num = Double.parseDouble(br.readLine());
            if (num > 0) {
                countPositives++;
            }       
        }
       
        System.out.println(countPositives + " valores positivos");

        return;
    }
   
    public static void main(String[] args) throws NumberFormatException, IOException {
        Main processando = new Main();
        processando.processa();
       
        System.exit(0);
    }
}

Comments

Popular posts from this blog

(Coderbyte) Dash Insert II - Solução

(Coderbyte) Run Length - Solução

(Coderbyte) Counting Minutes I - Solução