answersLogoWhite

0

public class apples {

public static void main(String argc[]) {

for(int i = 0; i <= 50; i++){

if(i % 2 != 0){

System.out.println(i);

}

}

}

}

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
More answers

The for loop is very useful for this. Just start with 51, and add 2 at a time.

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Java source code of odd numbers between 1 and 50?
Write your answer...
Submit
Still have questions?
magnify glass
imp