//I have here very nice example for forloop.
class forloop { //Your class the name of the is 'forloop
public static void main(String[] args) {
for(int x=1; x<=10;x++) { //
System.out.println("Number: " + x);
}
/*
Instructions
int x=1 is your declaration of your variable starts from 1 to 10.
x<=10 is your condition til the condition becomes false.
x++ is your Incrementation in-order your x will move starts 1 to 10.
System.out.println("Number: " + x); is for display Number : 1 to 10
*/
}
}
/*
********OUTPUT**********
Number: 1
Number: 2
Number: 3
Number: 4
Number: 5
Number: 6
Number: 7
Number: 8
Number: 9
Number: 10
*/
Download File
how to make pyramid . .using forloop? can u do this?
ReplyDeleteand also diamond forloop?
ReplyDeletePYRAMID
ReplyDeletefor(int i=1; i<= 5 ;i++){
for(int j=0; j < i; j++){
System.out.print("*");
}
System.out.println("");
}
for(int i=5; i>0 ;i--){
for(int j=0; j < i; j++){
System.out.print("*");
}
System.out.println("");
}
___________________________
OUTPUT:
*
* *
* * *
* * * *
* * * * *
* * * * *
* * * *
* * *
* *
*
Hi,
ReplyDeleteim a college student and we have a project about java programing,related in loop and array,please help me to build a input of simple games, or any concept,
Thanks for answering some question. Thank you
ReplyDeletedon't try to a be game programmer first of all you should learn the core concept of java.
ReplyDeleteIt's not a good idea to start a project using game programming. I suggest you to make a real thing in java.
good day... im having a hard time using loop how can i make a java program to determine the number of digits of an inputted integer??
ReplyDeleteplease help
hi can you help me do a for loop which out puts two pyramids facing each other?,,, tnx
ReplyDeletesir/mon can you also post some code of post test and pre tesvt loop code ,, please
ReplyDelete]
heck
ReplyDeletewhat the heck tlaga!!!!!!!!!!!!!!!!
Delete