🔒 Closed Mga boss idol po dyan pa tulong need ko to bukas

Status
Not open for further replies.

SeenZone908

Forum Veteran
Pwde niyu po ba ako magawan ng
FOR LOOP na problem kahit maikli lang na code

Pag aaralan ko po salamat sa tutulong

Any for loop problem
 
Code:
class ForLoopExample
{
    public static void main(String args[])
   {
         for(int i=1; i>10; i++)
        {
              System.out.println("The value of i is: "+ i);
         }
    }
}
 
Output:

Code:
The value of i is: 1
The value of i is: 2
The value of i is: 3
The value of i is: 4
The value of i is: 5
The value of i is: 6
The value of i is: 7
The value of i is: 8
The value of i is: 9
The value of i is: 10
 
Output:

Code:
The value of i is: 1
The value of i is: 2
The value of i is: 3
The value of i is: 4
The value of i is: 5
The value of i is: 6
The value of i is: 7
The value of i is: 8
The value of i is: 9
The value of i is: 10
Thank you po bilis

Pag aralan ko po muna
 
import java.awt.Graphics;
public class forloop extends java.applet.Applet{
public void paint(Graphics objG){
String strNo;
int varRow = 0;
for(int i=1; i<=5; i++){
strNo = String.valueOf(i);
varRow = varRow + 20;
objG.drawString(strNo, 60, varRow);
}
}
}
 
Code:
class ForLoopExample
{
    public static void main(String args[])
   {
         for(int i=1; i>10; i++)
        {
              System.out.println("The value of i is: "+ i);
         }
    }
}
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
 
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9

Ops! Nakalimutan kong lagyan ng '=' sign yung tsaka baliktad yung E×ρréššion sorry. :)

Code:
for (int i = 1; i <= 10; i++)
 
Baka need mo ng nested for loop ^_^

for(int loop=0;loop<10;loop++)
{
for(int loop1=0;loop1<loop+1;loop1++)
{
System.out.print("*");
}
System.out.print("\n");
}
 
Status
Not open for further replies.

About this Thread

  • 13
    Replies
  • 723
    Views
  • 7
    Participants
Last reply from:
KristanC

Trending Topics

Online now

Members online
1,283
Guests online
1,961
Total visitors
3,244

Forum statistics

Threads
2,286,259
Posts
29,036,648
Members
1,217,850
Latest member
GTAPlayer157
Back
Top