• Register

Recent questions tagged for-loop

0 votes
1 answer 4 views
Problem: Hi there! I am new to the world of programming and learning loop constructs in C#. My concept for loops is clear but I just recently encountered a code somewhere in which for loop was initialized as follows: for(;;) { } I tried running that code, but it ... I make some mistake but I want to know more about ‘for’ loops and all the possible ways in which it can be used. Thanks!
asked 4 days ago Sheeza 3.9k points
0 votes
1 answer 4 views
Problem: Hello When you know exactly how many times you want to loop through a block of code, use the for loop instead of a while loop: Statement 1 is executed (100 time) before the execution of the code block. Statement 2 defines the condition for executing the code block. Statement 3 is executed (every time) after the code block has been executed.
asked Nov 3 Mashhoodch 1.2k points
0 votes
1 answer 14 views
Problem: How can I break out of a for loop in C#? I am working with arrays in C# and want to break the loop when loop variabl encounters certain value. How can I do that? Please explain.
asked Oct 15 Sheeza 3.9k points
0 votes
1 answer 44 views
Problem: I am working with loops. My query is that can I increment a foor loop by 2? If yes, then how? Please explain in detail and with syntax and examples because I am a newbie and have no experience in programming. Thanks
asked Oct 15 Sheeza 3.9k points
0 votes
1 answer 35 views
I need help with the basics, I need to print 1 to100 numbers in python. Please explain with the help of an example.
asked Oct 10 Ahsan 1.8k points
0 votes
1 answer 16 views
Explain with an example?
asked Oct 8 jagruthi 680 points
0 votes
1 answer 28 views
I want to know how to sort an array in java without using sort method.
asked Sep 28 Daniel Anderson 4k points
0 votes
1 answer 23 views
We have obtain a full of data stored in tables via Mysql on which we have done few analysis and also export microsoft excel to create graphs and such however the customer demand it to be a desktop application.
asked Sep 26 Daniel Anderson 4k points
0 votes
1 answer 10 views
Problem: Hello kodlogs, I am learning the python basic concept but while working on the string I having a doubt like how can I able to append to the string in the loops, I am having the list. list = ["alpha","beta","gamma","delta"] And how can we in inside a for loop I need to end with this: final_string ="firstsecondkodlogs" So, how can I achieved this.
asked Jun 10 Gavin 15.3k points
0 votes
1 answer 31 views
Problem: Hello kodlogs, How can we use for loop in the python to iterate over the sequence of element I have a confusion over the range() function and the datatype like list, tuple and string. Like how can we access the elements in the list
asked Jun 9 Gavin 15.3k points
1 vote
1 answer 35 views
Problem: Hello Kodlogs, I am here with a problem. This could be a simple problem for you, guys, but it’s driving me crazy. I am in a situation that needs to print multiple values in a single line. Let me describe it in my words. Say, have some integer ... value in a different line and there is no option to concatenate them. Could you please help me out? Thanks for your concern and kind help.
asked Jun 2 adamSw 11.3k points
1 vote
1 answer 25 views
Problem: Hello guys, I’ve got a python list full of data. I want to print them reversely. The only condition that has to follow is to use a for-loop in the program. I know there could be several ways to do that but I want for-loop to do that. ... you've any suggestion in this regard? Please, keep your answer as simple as possible. It would be helpful for me to understand well. Thanks.
asked Jun 2 adamSw 11.3k points
0 votes
1 answer 31 views
Problem: Hello guys, I am trying to understand deeply how two variables work inside a for-loop or iterate simultaneously? Where to use it and what is the purpose of it in a program?
asked May 31 adamSw 11.3k points
1 vote
1 answer 315 views
Problem : I am very new to programming. I need to write a program called swapAdj that must accept the array of integers and after that swap those elements at the adjacent indexes. For example consider the elements 0 and 1 are swapped by the program and after ... note if your array has the odd length then the program must keep final element unmodified. Please help me in writing above program.
asked Apr 7 morrisBson 3.2k points
1 vote
2 answers 78 views
Problem : I am very new to programming world. According to my senior a for loop will always get executed at least once even if a required condition is not met. Please find below example for your reference: for (int i=6; i <=5; i++) {     //inappropriate for this ... } According to my senior above listed loop will be executed at least once but it does not or let me know if I am I missing something?
asked Apr 6 morrisBson 3.2k points
3 votes
2 answers 2.6K views
Problem: I am struggling with a problem for a few hours back. I know how to sort an array by using methods. I was looking for another way (perhaps a loop) to do it more efficiently. Let me put my question this way, how to sort an array in java without using sort method? Could anybody here please help to make this happen? Thanks in advance
asked Mar 24 Gavin 15.3k points
2 votes
1 answer 114 views
Problem: Hi all, I am an entry-level student in Python programming. I have got an assignment from my lecturer to write a program that prints a diamond shape made of *. Well, I want to learn from the very basics. As I understood it might be the very basics of printing ... to write a nested loop program to print a rectangle. sample output for the given program below: * * * * * * Thanks in advance
asked Mar 17 Gavin 15.3k points