Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:50:55+00:00 2026-06-14T10:50:55+00:00

Right, before I start: this is a hw question. We have to print out:

  • 0

Right, before I start: this is a hw question.

We have to print out: -20, -15, -10, -5, 5, 10, 15, 20

for(i = -20; i<25; i += 5)
    {
        System.out.println(i);
    }

I’ve gotten it to output all the numbers, however, we’re not allowed to output 0.

This question has me stumped . Any help please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:50:57+00:00Added an answer on June 14, 2026 at 10:50 am

    So in programming there are conditional statements. In java the keyword for this is if. These statements only execute if the condition they check is true.

    In your case you have a condition, “I want to print out all numbers EXCEPT for zero”. You can take this and turn it into an if-statement. To do that you convert your statment to something like “as long as the number is not zero, print it out”. So once you’ve reached this you can write:

    if (i != 0) System.out.println(i);

    So everytime you go through the loop the condition will check if i is any number different from zero. If it is the print statement will execute. When it is zero it will do nothing as the statment we placed does not evaluate to true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asked this before but I didn't get the question right so the
NOTE : Right before posting this question it occurred to me there's a better
I have a gridview that is only shown in a modal popup. right before
I have the following CSS code .editable:before { content: url(../images/icons/icon1.png); padding-right:5px; } this is
Sorry if this question has been asked 100 times before, unfortunately, i haven't found
Edit: While this question has been asked and answered before ( 1 ), (
I have used this question to learn install my python script as a service
I will start by apologising if this is a naive, simple or stupid question.
I've got 3 parts to this question: I have an application where users create
This is probably a silly question. Let's say I have 20 event handlers that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.