4 Replies - 1000 Views - Last Post: 14 November 2011 - 06:50 PM Rate Topic: -----

#1 jc5211   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 13-November 11

How do I convert "for(;n<=a;)" in C to java?

Posted 14 November 2011 - 04:22 PM

How do I convert "for(;n<=a;)" in C to java?
Is This A Good Question/Topic? 0
  • +

Replies To: How do I convert "for(;n<=a;)" in C to java?

#2 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1824
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: How do I convert "for(;n<=a;)" in C to java?

Posted 14 November 2011 - 05:01 PM

Why you need the for loop in that case? why not just use while instead. The for loop syntax is the same in java for the case, so you will have the same thing.
Also you can look at loop tutorials:
http://www.dreaminco.../59169-looping/
http://www.dreaminco...a-for-n00blets/
Was This Post Helpful? 0
  • +
  • -

#3 The_Programmer-   User is offline

  • Paranormal Investigator
  • member icon

Reputation: 25
  • View blog
  • Posts: 694
  • Joined: 24-October 11

Re: How do I convert "for(;n<=a;)" in C to java?

Posted 14 November 2011 - 05:44 PM

Just use
while (n <= a) {
//do stuff
}

Was This Post Helpful? 0
  • +
  • -

#4 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7163
  • View blog
  • Posts: 14,929
  • Joined: 16-October 07

Re: How do I convert "for(;n<=a;)" in C to java?

Posted 14 November 2011 - 06:06 PM

That, um, is Java... :P

However, I'd go with the while, as suggested.
Was This Post Helpful? 0
  • +
  • -

#5 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: How do I convert "for(;n<=a;)" in C to java?

Posted 14 November 2011 - 06:50 PM

for(;n<=a;)

is a valid Java statement what do I miss ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1