+ 1
I am unable to run for loop, please help
For loop
26 odpowiedzi
+ 6
python:
for i in range(start, end, increment):
statement-block
for eg,
for I in range(1,10,2):
print(i, end="")
Ruby:
for I in (1...10)
puts i
end
c++:
for(assign, condition, increment){
statement-block
}
for eg,
for(i=1;i<=10;i++){
cout<< i << end;
}
Java:
for(int i=1;i<=10;i++){
system.println.out(i);
}
C:
for(int i=0, i<10, i++)
printf("%i", i);
which language for loop do you ask?
Explain the question clearly?
+ 5
remove semicolon after
for(i=1;i<=10;i++)
+ 3
You mustn't set a semicolon after for
+ 2
es6 in 4th item in the above list pertains to java👆
+ 2
You may find answer in https://www.javatpoint.com/java-for-loop
+ 2
you may find answer in https://www.javatpoint.com/java-for-loop
+ 2
for(i=1;i<=10;i++)
the last vale 10 will be incremented to 11
+ 2
Recheck ur program
By removing the semicolon after the statement
+ 1
Please remove the semicolon after your first line of loop because when you set the semicolon There you separate the loop and the cod in
Im sorry my english is Awful
+ 1
I think its good to add "\n" after i in your print function to go to next line after print
+ 1
You did not mention the programming language.
Hence following Information covering few Programming Languages:-
1) https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/for-loop
2) https://beginnersbook.com/2017/08/cpp-for-loop/
3) https://www.tutorialspoint.com/cprogramming/c_for_loop.htm
4) https://www.geeksforgeeks.org/es6-loops/
+ 1
Thats how the for loop is=
For( i =0 ; i<= 10 ; i++ )
No semicolon at end .......
+ 1
Thanks Asrar Naveed Ahmad
+ 1
My pleasure.Nilesh Chawla
0
public class Program
{
public static void main(String[] args) {
int i;
for(i=1;i<=10;i++);
{
System.out.print("Value is " + i);
}
}
}
0
I am getting value as 11
0
But I require series of value from 1 to 10 one by one
0
Please help
0
Thanks a lot, how a ; make a difference here?