Program using for, ask the user to insert an N number and show on the screen all odd numbers up to N

Asked

Viewed 27 times

-3

package br.com.DoWhileAugusto;

import java.util.Scanner;

public class DoWhileAugusto {

 public static void main(String[] args) {
   Scanner entraResposta= new 
   Scanner (System.in);
   int resposta;
 
   int pares;
   System.out.println("Este programa mostra todos os números pares antes do número que você colocou");
   System.out.println("Coloque um número inteiro");
  
   
   resposta=entraResposta.nextInt();
   
   if(resposta % 2 == 0)
   ?
   else{
    System.out.println(".");
   }
  }
}
  • Could format the code for better viewing ?

  • What’s the problem? What’s not working as it should in your code? Also, are you looking for an answer in Java (confome the code) or Javascript (depending on the tag)? We need you to make that clear in the question so we can answer it properly. See "How to ask a good question".

  • This is [tag:java] and not [tag:javascript].

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.