(URI) Preenchimento de Vetor III - Solução

import java.io.*;
import java.util.*;
import java.text.DecimalFormat;

class Main  {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        double valor = Double.parseDouble(br.readLine());

        DecimalFormat df = new DecimalFormat("0.0000");
       
        for (int i = 0; i < 100; i++) {
            bw.write("N["+i+"] = "+ df.format(valor)+"\n");
           
            valor /= 2.0000;
        }

        bw.flush();       
        bw.close();
    }
}

Comments

Popular posts from this blog

(Coderbyte) Dash Insert II - Solução

(Coderbyte) Run Length - Solução

(Coderbyte) Counting Minutes I - Solução