for(START, END, INCREMENT){
// some command
}
So, if you want to show number 1-10, you just create code like this:
for(int i=0;i<=10;i++){
System.out.print(i);
}
explanation:
int i = 0 is set up the first number
i<= 10 is a limited number. Symbol <= means i value smaller or same than 10
i++ is for increment first number. If you want to decrement function, you can write as i--
No comments:
Post a Comment