Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java for loop Code
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hina Saeed
Java for loop Code
1 Answer(s)      6 years and 9 months ago
Posted in : Java Beginners


Hi, please give me a simple for loop example in Java.
Thanks in Advance!!


Advertisement
View Answers

April 7, 2008 at 7:14 PM


Hi


This is your solution.

public class PrintExample{
public static void main(String[] args){
int i=0;
int j;
for(i=0; i<=8; i++)
System.out.print("*");
System.out.println();
i=7;
while(i>=1){
for(j=1;j<=i;j++)
System.out.print("*");
i=i-2;
System.out.println();
}
}
}


Related Tutorials/Questions & Answers:
java code using while loop
java code using while loop  
print this image in java code using only loop{for, if, loop}
print this image in java code using only loop{for, if, loop}  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  ... is a code that displays the following pattern
Advertisements
Java for loop
Java for loop  Can a for statement loop indefinitely
for loop in java
8 9 6 7 8 9 10 all for loop code plz friends guide me...for loop in java  54321 4321 321 21 1 using for loop or nested 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 using for loop or nested
for loop in java
8 9 6 7 8 9 10 all for loop code plz friends guide me...for loop in java  54321 4321 321 21 1 using for loop or nested 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 using for loop or nested
for loop in java
8 9 6 7 8 9 10 all for loop code plz friends guide me...for loop in java  54321 4321 321 21 1 using for loop or nested 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 using for loop or nested
for loop in java
8 9 6 7 8 9 10 all for loop code plz friends guide me...for loop in java  54321 4321 321 21 1 using for loop or nested 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 using for loop or nested
for loop in java
8 9 6 7 8 9 10 all for loop code plz friends guide me...for loop in java  54321 4321 321 21 1 using for loop or nested 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 using for loop or nested
for loop in java
for loop in java  1 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 3 4 5 4 5 6 7 5 6 7 8 9 6 7 8 9 10 using for loop in java   Java Number Pattern 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 public class PatternExample{ public static void main
For loop java
For loop java  1 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 3 4 5 4 5 6 7 5 6 7 8 9 6 7 8 9 10
Java Loop - Java Beginners
Java Loop   WAP to print d following pattern wid d help of any loop(for or while or do-while
For Loop in Java
For Loop in Java - Java For Loop Examples & Syntax       The for loop is the type of  looping construct. It also works as while loop construct but it provide the initialization
Java Loop 2 - Java Beginners
Java Loop 2  WAP to print d following patter wid d help of ne loop possible
While loop - Java Beginners
While loop  Given a number, write a program using while loop....  Hi friend, Code to solve the problem : import java.io.*; class...; } System.out.println("Reverse Number : " + rev); } } For more information on Java
LOOP PROGRAM - Java Beginners
LOOP PROGRAM  Hi all, Someone please help this code. I need a Java program that uses looping to toss a coin over and over until it comes up head.... Thanks.  Hi Friend, Try the following code: class Toss{ public
for loop
it is infinite loop. Java provides several loop structures for iteration. Those...for loop  what is for loop   Loops are used for iteration which means to execute a part of code repeatedly. Repetition of a part of code
For Loop Statement in java 7
For Loop Statement in java 7 In this section, we will discuss about for loop in java 7. This is one type of  loop statement. For Loop Statements : For loop is one way of looping to iterate block of code under certain condition
loop problem - Java Beginners
loop problem  I trying to write a program which prints out even numbers, I've got that part, however, I need to only have 5 numbers per line. ex... something. Can you help?   Hi Friend, Try the following code: class
Nested Loop - Java Beginners
Nested Loop  Hi, Can anyone tell me example of Nested loop in Java? Thanks   Hi friend,public class NestedExample{ public static void main(String[] args){ /** Print Pattern I */ System.out.println("
for loop in java example
.style1 { color: #0000FF; } for loop in java example We are going to discuss about for loop in java example. The for loop statement has type loop control statement. We first initialize the variable. After that check
loop
loop  i want to write my name(inder) through loop in java using star
loop problem - Java Magazine
loop problem  import java.util.Scanner; class mychoice{ public static void main(String[] args){ Scanner choice = new Scanner(System.in... to main menu to select new item. //what loop to use? break
FOR Loop In JSP
in Java i.e. syntax of the for loop is same as its syntax defined for using in core Java. Syntax of for loop for(INITIALIZATION; CONDITION; INCREEMENT...FOR Loop In JSP In this section we will read about how to use the for loop
Learning the for loop - Java Beginners
Learning the for loop  Good evening gentlmen! I'm new to Java programming and I would like to learn how I can find if the Theorem of Thales (a*a + b*b = c*c),exists in integers between 1-500.I want to find the size of every
for loop - Java Beginners
for loop  write a program to print the following series :10000,5000,2500,1250,625.  Hi Friend, Try the following code: class Series{ public static void main(String[] args){ int num=10000; System.out.print
for loop - Java Beginners
for loop  write a program to enter two numbers and print their HCF.   Hi Friend, Try the following code: import java.util.*; class HCF{ public static int determineHCF(int a, int b) { if (b==0
java loop programming - Java Beginners
java loop programming   Write a jaVA program to initialize 3 characters, and print the decimal value when the input is interpreted as a 3-digit hexadecimal number. Accept upper case letters for values from 10 to 15 i.e.
Loop
to understand a loop my quesiton are: what du i do wrong in my code since.... (made in blueJ) Class Loop public void loopUpGeneral(int start, int stop... dk  Hi, Please check the for loop once again: for (int i
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
 

 

 

DMCA.com