-2
Hello, I am new here and in the world of programming. I would like to know how to do the last part of this exercise using For. So far I have done this:
for(int i = 1; i<=100; i++) {
if(i%2==0) {
System.out.println(i+" é par");
}else {
System.out.println(i+" é ímpar");
}
if(i%3==0){
System.out.println("é múltiplo de 3");
}
if(i%4==0) {
System.out.println("múltiplo de 4");
}
What is the question specifically ? Checking if the numbers are primes ? What have you already done for this purpose ? Where did you get stuck ? I don’t see any code in the question concerning that
– Isac
Boy, I wanted to know first how to make that second go, inside the if, inside the other for.
– B.Barbosa
My suggestion is to do each thing individually, and in the end put it all together, as if it were a piece. This way you learn how to do each part. In this sense the next step would be to make a code to verify if a number is prime. Then if you succeed, put the two parts together in the right way.
– Isac
Right. Thank you very much ✌
– B.Barbosa