Most voted "loop" questions
Loops are a type of flow control structure in programming in which a series of statements can be run repeatedly until some condition is satisfied.
Learn more…671 questions
Sort by count of
-
0
votes1
answer184
viewsHow to get the program out of the loop
In the exercise I am doing, it is asked that when the number of repetitions is 0, finish the execution, but when I type 0 it does nothing and continues to read numbers. It reads a number K of…
-
0
votes1
answer38
viewsLoop repeating works in one case, but does not work in another (JS)
I am not able to understand why the loop below works to assign a new value to the index, but does not work to change the property of an object. What I did wrong, you guys? var p = ["teste1",…
-
0
votes0
answers21
viewsHow to Stop This Observable "unsubscribe"
Looking for a way to receive data inside a setTimeout, to do what you need and or stop your replay, I thought about creating a file, so when I receive the then or catch of this function, I stop the…
-
0
votes1
answer28
viewsProgram ignores the first scan of the loop
Basically I have this program int main(){ coordenada lista1_coordenadas[3]; coordenada lista2_coordenadas[3]; for (int i=0;i<3;i++){ printf("Leia a coordenada %d da primeira lista:\n", i+1);…
-
0
votes1
answer57
viewsMacro to open, stack and save several . sequential csv files in SPSS
How to program a macro that: Only import a few columns (for example: ano, mes, id, valor and motivo ) of sequential . csv files for SPSS. These files would have type names: DADOS_JAN_2010,…
-
0
votes1
answer35
viewsProblem checking between two python variables
This code is made to generate a password of X random numbers (1 in the case), and then loop random passwords until you get to the initial password, "bruteforce". Although it can generate the first…
-
0
votes1
answer40
viewsQuestions about C-language loop/array
Hello! I did a basic program to calculate the averages of 4 students. The problem is that the result of it, in the final screen, appears the phrase "Insert 4 Notes student 5 here: " without having…
-
0
votes0
answers10
viewsHow to repeat a code at the end?
Hello, I’d like to know how to make this code repeat at the end, I know it may seem simple but I haven’t found anywhere the answer var = int(input('Insert: 1 for +; 2 for -; 3 for X; 4 for /; 5 for…
-
0
votes2
answers56
viewsLooping and Finishing? In Python
Hi, guys. I have a problem with my program. I’m not getting it looped until I "shut it down" it. I’ll be leaving his code, making it easier for you to understand. Where the operator selected to play…
-
0
votes0
answers29
viewsHow to access the value of an array within a while loop in SQL?
In the database I’m working on there are a number of salary variables that are registered as strings with entries like 0000001155,00. I’m using a combination of CAST and REPLACE to turn these…
-
0
votes2
answers248
viewsChecking repeated character in Python list
Hello! I’m trying to develop a program that reads a string and returns a boolean if there are repeated characters. I need enough on that score: ("") // False ("oo") // False ("po") // True…
-
0
votes1
answer65
viewsHow do I make a loop only continue after an if is performed!
I am programming a bot for Discord that asks questions and checks if they are right, but the doubt that this taking nn is with the lib discordjs itself but with the language itself!! And the…
-
0
votes0
answers65
viewsPick up dynamic button ID inside the PHP loop with Javascript and/or Jquery to Open Modal Without Bootstrap
I need to take the dynamically generated sequential Ids from the PHP loop to open a Modal without bootstrap. I have tried several things I saw on the internet, I come here to try something so that…
-
0
votes2
answers58
viewsInsert values into an array with dimensions defined from a loop
Good afternoon, I am trying to save values in the form of an array from different text files, using a loop. I need the values obtained from the first iteration to be stored in the first line of the…
-
0
votes1
answer40
viewsMy Javascript code loop is not working correctly
function contar() { let inicio= document.getElementById('inicio').value let fim= document.getElementById('fim').value let passo= document.getElementById('passo').value let res=…
-
0
votes0
answers18
viewsVisual Basic for Word, Infinite loop when pasting image
Hello, first question here. I have very basic knowledge of VB. Need for each image of a Word document to perform the following task 1.Dimensionar 2.Insert Paragraph 1 3.Paste(pasted element will be…
-
0
votes1
answer37
viewsData storage problem in the vector
I’m learning to program and I’m having a hard time finding the error of this program. The note array is storing the 6 notes (2 of each student), but only puts the last two in the array. The problem…
-
0
votes1
answer32
viewsLoop to change text from a cell (A) when you click a button (B) located on the same row as the cell (A) in an HTML table
I have a table with dates on which I am mounting a button that adds seven days to the present value. As there are several lines, the intention is that each date has its own postponement button,…
-
0
votes1
answer48
viewsI’m having a problem running a repeat on C
Description of the issue: "Implement the function below that takes a string and compresses it into a single character, any set of consecutive repeated characters." function: char *strpack(char *s)…
-
0
votes1
answer34
viewsFor loop in R is repeating answers more times than desired
I need help for this loop that is returning more answers than desired. I made a table from the public dataset palmerpenguins and my goal is to get an estimate of the penguins' gender with missing…
-
0
votes1
answer85
viewsC language - Error when using loop scanf to obtain integer and string type data
At first I was trying to make a binary tree that receives values of the intiro and string type (name and surname). But I’ll just put a bug to fix first. #include<stdio.h>…
-
0
votes1
answer21
viewsHow to go multidimensional picking up key and value?
Hello I have a multidimensional array and I need to go through all levels $items = [ 'janeiro' => [ 'alimentos' => [ 'item1' => 100, 'item2' => 50, 'item3' => 200, ], 'limpeza' =>…
-
0
votes0
answers25
viewsInactive GPS notification running on APP startup only
Ola, I need to adjust the app I’m developing so there’s notification whenever GPS is disabled. When the app starts, if the GPS is disabled, it alerts and then starts the Switch to location settings.…
-
0
votes0
answers55
viewsProgram enters Infinite Loop - Problem "Horse Ride" in C
The problem of the horse consists of which, the horse is placed on the board emptiness and, following the rules of the game, need to go through all the houses exactly once in consecutive moves. ie…
-
0
votes1
answer53
viewsHow to convert an entire string to uppercase characters without using loop?
I have the following code: #include <iostream> #include <ctype.h> using namespace std; int main() { string nome = "pedro", up; for (int n = 0 ; n != nome.length(); n++) { up +=…
-
0
votes1
answer49
viewsAdd nodes to the chained list using loop
I did not find any similar question, in case you have, please indicate and I delete the post. How to create a chained list so I can use a for loop to put the nodes in the list. I’m using two…
-
0
votes1
answer71
viewsHow to implement the sine function using Taylor series in Python?
I’m having a little trouble with my code. I need to create a code that calculates the sine of an angle using the Taylor series, in the range of [-pi, +pi]. Thus, the sine function repeats. That is,…
-
0
votes1
answer24
views -
-1
votes1
answer1593
viewsForeach repeating the same content
Setting I have a form and via POST send to the page preview.php 10 song names that are divided between 4 arrays. I can generate the 10 Divs containing the position array but when I create the…
-
-1
votes1
answer73
viewsHow does the loops and variables in Jekyll work?
When I compare in if if the post.category it’s like there’s no post variable that’s in for more when I put {{post.category}} it prints the name. It’s like in if he wouldn’t exist anymore if I put…
-
-1
votes1
answer865
viewsConversion from flowchart to code
I am trying to convert a sizable size flowchart to Arduino code. The flowchart is as follows:: Considering your size, I’d feel more comfortable using the remote goto as a flow control. However I…
-
-1
votes1
answer52
viewsLoop code not satisfied
import java.util.Scanner; public class CodigoDeBarras { public static void main (String[] args) { do { Scanner sc = new Scanner(System.in); System.out.println("Informe os primeiros 12 caracteres do…
-
-1
votes1
answer720
viewsSudoku game resolution giving infinite loop in C
I have the following code on C: #include <iostream> #include <stdio.h> #include <stdlib.h> #include <time.h> // Variáveis globais int jogo_tabuleiro[9][9] = {0}; int…
-
-1
votes1
answer422
viewsHow to invert the order of loop results in PHP?
I wrote a code based on tutorials I saw to show User Comments Database information in tables but I would like it to reverse the order of the results. How can I do that? <?php // se o número de…
-
-1
votes2
answers2073
viewsWhile inside While (While principal stops)
I need to create two bonds going from 1 to 10, only one inside another. WORKS Using for and for. Using while e for. Why doesn’t it work? 1) WHILE AND WHILE int a=1, b=1; while(a<=10) {…
-
-1
votes1
answer60
viewsHow to make two loops for the same code just go varying the column of the courses and the columns of the questions?
I have a data.frame with lots of code in the rows and lots of columns of questions, I’m doing the simple frequency of each question I would like to know how to vary the courses and questions at…
-
-1
votes1
answer493
viewsFor without the use of key
#include<stdio.h> int main ( void ){ int row; int column; for ( row = 1; row <= 7; row++ ){ for (column = 1; column <= row; column++ ) printf("*"); printf("\n"); } printf("\n"); } I want…
-
-1
votes1
answer101
viewsCode enters infinite loop
Why is this code on loop infinite? #include <stdio.h> #include <stdlib.h> #include <conio.h> int main() { int i; float salario[10], valorDataBase, salarioReajustado[10];…
-
-1
votes1
answer343
viewsFill a Loop Multidimensional Array from 3 separate PHP arrays
Someone knows a way to fill a Multidimensional Array with a Loop structure from 3 separate PHP arrays? Separate arrays are in the following structure: After filling with some loop structure a single…
-
-1
votes1
answer1320
viewsHow to navigate a matrix in Matlab?
Good evening! Can anyone help me with this exercise? "Create a filename filter_matrix. m and save it to your personal account. Type a function name filter_matrix that receives a matrix as an…
-
-1
votes2
answers137
viewsHow to use Readkeey in C#
int loop = 0; while( loop >= 0 ) { int aa; int an; Console.WriteLine( " Qual o Ano Atual? : " ); aa = Convert.ToInt16( Console.ReadLine() ); Console.WriteLine( " Qual o Ano de Nascimento? : " );…
-
-1
votes2
answers74
viewsSeparate a datraframe in subdatraframes based on a condition
I would like to generate subsets of a dataframe via loop. However, when executing this code I do not get the 5 objects. list <- list("CO", "N", "NE", "S", "SE") for (i in list) { df_name <-…
-
-1
votes2
answers543
viewsHow to generate random numbers without rethinking in Java?
Something similar to the code below. Numbers in the Random range that do not repeat public void sorteiaCartelaB() { for (int i=0; i < b.length; i++) { b[i] = (int)(Math.random() * 60 + 1); for…
-
-1
votes2
answers161
viewsTerminate program with enter/ EOF
I need the code to end after an empty enter, with no input or the 'EOF', but I don’t know how to apply it and I didn’t understand very well the examples I saw. The program is almost complete, it…
-
-1
votes1
answer254
viewsMulti-entry loop for list - Python
I have a list of several tuples inside, and within tuples various elements. I need to scan all tuples on the list to capture an element that is inside each of these tuples. How can I do this? The…
-
-1
votes2
answers71
viewsThis code is leading me to an infinite cycle and I can’t figure out why
This code is leading me to an infinite cycle and I can’t figure out why. #include <stdio.h> #include <stdlib.h> #include <time.h> void troca (double *n1, double *n2) { double n; n…
-
-1
votes1
answer1859
viewsA solution to break/continue a Python loop?
The point is, I can’t find a solution that replaces using the console for my small application. What happens is: My app runs in eternal loop, but after it runs the loop, it should stop to ask if I…
-
-1
votes1
answer90
viewsngFor with checkbox is selecting all values
I have the following checkbox with a repeating structure: <div *ngFor="let tela of telas" class="custom-control custom-checkbox check"> <input type="checkbox" id="{{tela.nome_tela}}"…
-
-1
votes1
answer190
viewsRepeat structure within the selection in visualg
Function :Write a program that creates an initially zeroed vector and insert a value into the vector at an informed position. For example, for the empty vector v = { }, position 4 and value 10, the…
-
-1
votes1
answer63
viewsHow to loop to load Json result
People are in need of help, I am carrying some information from Json, as follows:: <?php $json_data = json_decode(file_get_contents('arquivo3.json'), true); foreach ($json_data["Result"] as…