Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Count 100
#1
This is more of an explanatory program than a practical. It will count to 100 and show you when it it finished.
[code2=java]import java.util.Scanner;
public class New {

static Scanner input = new Scanner(System.in);
public static void main(String[]args){
countNumber();}


public static void countNumber(){
int i = 0;
while (i <= 100){//The while statement says that this will repeat 100 times
System.out.println(i);
i++;
if(i == 101){
System.out.println("I now equals 100");


}
}
}
}[/code2]
p.s. Sorry that it does not tell you exactly what is doing


Messages In This Thread
Count 100 - by WitherSlayer - 01-03-2013, 02:21 AM
Re: Count 100 - by brandonio21_phpbb3_import2 - 01-03-2013, 11:52 AM
Re: Count 100 - by WitherSlayer - 01-03-2013, 04:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)