For loops

class jamesprogram {

	public static void main(String args[]){
		
		for (int count=1;count<10; count++){
			
		System.out.println(count);
		}
	}
}

Displays:

1
2
3
4
5
6
7
8
9

class jamesprogram {

	public static void main(String args[]){
		
		for (int count=1;count<10; count+=3){
			
		System.out.println(count);
		}
	}
}

Displays:

1
4
7

Leave a Reply