# help in java homework anyone?



## entrana (Jan 16, 2008)

i need a simple program,  i think using for loop, to find odd numbers till a specified number using command line argument. like i want to find out all odd numbers till 10.


----------



## entrana (Jan 17, 2008)

aww cmon im sure u people know java


----------



## QwertyManiac (Jan 17, 2008)

```
class Odd
{
    public static void main(String args[])
    {
        int i=Integer.parseInt(args[0]);
        for(int count=1;count<=i;count+=2)
        {
            System.out.println(count);
        }
    }
}
```

Execute:

```
java Odd 9
```
Output:

```
1
3
5
7
9
```


----------



## Pathik (Jan 17, 2008)

Qwerty man how many languages do u know???


----------



## QwertyManiac (Jan 17, 2008)

Just a few, why?


----------



## Pathik (Jan 17, 2008)

Just asking. Cos you r very good at programming.


----------



## entrana (Jan 18, 2008)

thanks


----------



## QwertyManiac (Jan 18, 2008)

What did you find difficult in writing this one that you had to ask though?

Or is it just laziness?


----------



## entrana (Jan 20, 2008)

couldnt figure out that count+=2 thing. i was trying count+2


----------



## Faun (Jan 20, 2008)

entrana said:


> couldnt figure out that count+=2 thing. i was trying count+2



lol thats the basic (didnt u learn C ?)


----------



## casanova (Jan 20, 2008)

count+=2 is similar to count=count+2


----------



## redhat (Jan 23, 2008)

@entrana : I suppose ur still in school...

What grade are u in?
PM me....


----------

