What is wrong in solution:

for (int i = 1; i <= 100; i++)
        System.out.println(i);

asked 09 Jun '15, 05:39

Igor%20Samigulin's gravatar image

Igor Samigulin
11
accept rate: 0%


you need to print even numbers only(2,4,6...)

link

answered 19 Aug '15, 09:50

Anastasia%20Shatova's gravatar image

Anastasia Sh...
1
accept rate: 0%

This can be done using "i"

for (int i = 2; i <= 100 ; i = i+2) System.out.println(i);

link

answered 13 Nov '15, 15:09

Alina%20Munir's gravatar image

Alina Munir
113
accept rate: 0%

Test whether divisible by 2 completely

`for (int i = 1 ; i <= 100 ; i++)
{
      if (i % 2 == 0)
         {
              System.out.println(i);
         }
}`
link

answered 13 Nov '15, 15:12

Alina%20Munir's gravatar image

Alina Munir
113
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×35
×30
×3

Asked: 09 Jun '15, 05:39

Seen: 1,550 times

Last updated: 13 Nov '15, 15:12