Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Azi{
- public static void main(String[] args) {
- int numeroInput = 4;
- int umOuDois = 1;
- double resultado = 0;
- for(int i = 1; i<=numeroInput; i++){
- umOuDois = i % 2 == 0 ? 2 : 1;
- resultado += (Math.pow(numeroInput + umOuDois, 2) / i);
- }
- System.out.println(resultado);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement