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

#1 jc5211  Icon 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  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1752
  • View blog
  • Posts: 4,409
  • 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-  Icon User is offline

  • Death Scythe
  • member icon

Reputation: 24
  • View blog
  • Posts: 593
  • 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  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5643
  • View blog
  • Posts: 12,359
  • 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  Icon User is offline

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

Reputation: 8315
  • View blog
  • Posts: 31,836
  • 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