Loop
Hello all.
iam studying computer sience an need some help to understand a loop
my quesiton are:
what du i do wrong in my code since its endless.
i would like to control the "start" stop" and step from an object.
(made in blueJ)
Class Loop
public void loopUpGeneral(int start, int stop, int step){
for (int i = start; i = stop; step++) {
System.out.println(i);
hope to hear from a very patient person.
chipollini from dk
View Answers
October 13, 2010 at 7:22 AM
Hi,
Please check the for loop once again:
for (int i = start; <b>i = stop</b>; step++) {
System.out.println(i);
You are assigning the value here : <b>i = stop</b>; but it should be <b>i <= stop</b>;
The correct loop would be:
for (int i = start; <b>i <= stop</b>; step++) {
System.out.println(i);
Regards
Deepak Kumar
October 13, 2010 at 7:25 AM
Hi,
The correct code is:
public void loopUpGeneral(int start, int stop, int step){
for (int i = start; i <= stop; ) {
System.out.println(i);
i=i+step; //increment the i to step value
}
Thanks
Related Tutorials/Questions & Answers:
looploop what is the difference b/w do while,while and for
loop..with example
looploop i want to write my name(inder) through
loop in java using star
Advertisements
for loopfor loop what is for
loop
Loops are used for iteration... for a number of times it is finite
loop and if repetition is done infinitely it is infinite
loop. Java provides several
loop structures for iteration. Those
For loopFor loop Hi!
Please explain the following
loop:
for(i=0;i<a[j];i++)
THANX!!
Please reply as soon as possible
for loopfor loop how to performs the for
loop when 2 inputs given like displays the triangle shape and how to take initial values or declaration values plz explain in detailed ex.
1
12
123
1234
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
For LoopFor Loop Write a program using a for
loop that computes the following sum:
1/2 + 2/2 + 3/2 + 4/2 + 5/2 + ... N/2
N will be an integer limit the user enters.
This is an example of my upcoming quiz. I need help on knowing
looploop strong textHello can someone help me with this problem,I need to output the following code using a
loop the code is as follows with the user inputs in inverted commas,thanks.
ENTER CODE(XX to Stop)
CODE:"D24"
QUANTITY:"2
for loopfor loop using only two for
loop
how can print below numbers
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9
8 8 8 8 8 8 8 8
7 7 7 7 7 7 7
6 6 6 6 6 6
5 5 5 5
for loopfor loop using only two for
loop
how can print below numbers
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9
8 8 8 8 8 8 8 8
7 7 7 7 7 7 7
6 6 6 6 6 6
5 5 5 5
For..in loop For..in
loop
In this tutorial we will study for..in
loop which is similar to for each
loop
of C#, Java and other popular languages, in this example
For Loop - StrutsFor Loop Hi,
How to use for
loop in Struts2.
I don't want use....
How to use the For
loop in JSP.
Thanks,
Rajesh. Hi Rajesh,
i am sending simple use of for
loop. In this example, you will see the use
for( ) loop in phpfor( )
loop in php Generally, when we use for
loop in PHP or any other programming language why we use i++ and not ++i.
What is the reason behind
for( ) loop in phpfor( )
loop in php Generally, when we use for
loop in PHP or any other programming language why we use i++ and not ++i.
What is the reason behind
Limits of "For loop"Limits of "For
loop" Hi,
How can I check the upper limit and lower limit of 'FOR'
loop during unit testing using Junit.
Thanks & Regards
Ankit
How to write a loop and a while loopHow to write a
loop and a while loop How do I write a 1
loop and a 1 while
loop for the example code:
public boolean
isTheFirstOneBigger (int num1, int num2)
{
if (num1 > num2)
{
return true
loop statementsloop statements write a program that reads from input an interger n and prints the factorial of all numbers between 1 and n
for loop in javafor
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... 8 9
6 7 8 9 10
all for
loop code plz friends guide me
for loop in javafor
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... 8 9
6 7 8 9 10
all for
loop code plz friends guide me
for loop in javafor
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... 8 9
6 7 8 9 10
all for
loop code plz friends guide me
for loop in javafor
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... 8 9
6 7 8 9 10
all for
loop code plz friends guide me
for loop in javafor
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... 8 9
6 7 8 9 10
all for
loop code plz friends guide me
loop exampleloop example 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
can you give me the code to get the number pyramid
For Loop/PHPFor
Loop/PHP Write a class called math. It is to have one property... 12345.
How would you write this as a
loop? Would I need to use the for
loop or do/while
loop?
PHP Factorial Example:
<?php
$n = 5;
$i = 1;
$f
loop programloop program please tell me the code for the output
1
2
3foo
4
5bar
6foo
7baz
8
9foo
10
11
12foo
13
14baz
15foo bar
16
17
18foo
.
.......till 50
For loop javaFor
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
for loop in javafor
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
adding loopadding loop Hi I have a program that is not compiling when I add a
loop can you help me?The program below is compiling without the
loop.
>... the
loop is:
> Blockquote import java.util.*;
class Output
{
public
php do while loopphp do while loop Difference between do while
loop and simple
loop in PHP
ModuleNotFoundError: No module named 'for_loop'ModuleNotFoundError: No module named 'for_
loop' Hi,
My Python... 'for_
loop'
How to remove the ModuleNotFoundError: No module named 'for_
loop... to install padas library.
You can install for_
loop python with following
ModuleNotFoundError: No module named 'for_loop'ModuleNotFoundError: No module named 'for_
loop' Hi,
My Python... 'for_
loop'
How to remove the ModuleNotFoundError: No module named 'for_
loop... to install padas library.
You can install for_
loop python with following
ModuleNotFoundError: No module named 'loop'ModuleNotFoundError: No module named '
loop' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
loop'
How to remove the ModuleNotFoundError: No module named '
loop' error
ModuleNotFoundError: No module named 'for_loop'ModuleNotFoundError: No module named 'for_
loop' Hi,
My Python... 'for_
loop'
How to remove the ModuleNotFoundError: No module named 'for_
loop... to install padas library.
You can install for_
loop python with following
Infinite loop in c Infinite
loop in c When i type my variable as a uint32_t, it returns the infinite
loop why?
uint32_t i
FOR Loop In JSPFOR
Loop In JSP
In this section we will read about how to use the for
loop... are used e.g. while
loop, do while
loop, for
loop. In programming these loops are differentiated by
their syntax.
Loop is the execution of statements
Memory leak in While loopMemory leak in While loop How to manage a memory leak in While
loop ?
make sure
loop is not running infinitley...;make sure
loop is not running infinitley
javascript loop examplesjavascript
loop examples While running a javascript
loop function i am getting an error ..can any one post an example of writing loops in javascript?
Looping In Java Script