For Loop and while Loop question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: For Loop and while Loop question

  1. #1
    Join Date
    Jun 2006
    Posts
    5

    For Loop and while Loop question

    Hi i'm trying to make an output that lists numbers from 1 - 100 by using for loop and while loop. Here is my coding... It doesn;t work... can some1 correct it please? thanks.

    public class Loop{

    var i
    for (int i=1; i<=100; i++){
    document.write(i +)
    }
    }

  2. #2
    Join Date
    Jul 2005
    Posts
    78
    Is that Java?

  3. #3
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    no, it's not java. var and document are from javascript. that's something different, although both have common syntax and a common name part.
    for java try the following one:
    Code:
    public class Loop{
      public static void main(String argv[]){
        for (int i=1; i<=100; i++){
          System.out.println(i+"");
        }
      }
    }
    if you're looking for javascript, this is the wrong forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center