Questions tagged as 'for'

2
answers

Insert a point in the penultimate item of the variable

I have a variable with the value "14013" and I'm trying to insert a dot to get the following value "140.13" in my loop. for (var i in teste) { for (var j in (teste2[teste[i]])) { valorFinal[j] = resultado1 + resultado2; //valor...
asked by 18.07.2016 / 01:59
1
answer

Algorithm of prime numbers only works for the first verified number

I have created a prime number verification program and receive n entries in it. That is, n is the number of test cases. The problem is that in the first test case everything works fine. Already in the second onwards the program err...
asked by 01.07.2016 / 22:15
1
answer

How to return the last element of the array using the for?

I wanted to know how I get the last element of the array using the structure for in the case for decrement? My code is this: const a = n => n % 2 === 0; function callbackfn (valorInserido, funcao) { for (valorInserido.le...
asked by 25.01.2018 / 21:18
2
answers

What is the logic of for i 'in' in python

I'd like to know the logic of for i in vogais , as in the example. Doubt, does it load the entire typed word into a list in memory and already sorts according to our rankings, or does it read character by character? For example, if y...
asked by 01.03.2018 / 12:32
1
answer

for JavaScript onload

What is the reason why I do not get to call the function showSeatStatus(i); ? window.onload = function() { //Conecta os eventos de imagem de poltrona for (var i = 0; i < tamanhoMatriz; i++) { document.getElementById("a...
asked by 19.07.2017 / 03:16
1
answer

How to display only negative values in C?

I have three variables: int numero1,numero2,numero3; Once you have declared them, I am asked the user to populate them: printf("Digite o primeiro numero inteiro: "); scanf("%d", &numero1); printf("Digite o segu...
asked by 29.03.2017 / 06:36
1
answer

Logical doubt of the code in PHP

Hello everyone. I'm starting in PHP and I'm having some issues with this code: <?php function linha($semana) { echo "<tr>"; for ($i= 0; $i <= 6; $i++) { if (isset($semana[$i]))...
asked by 02.03.2017 / 15:19
1
answer

Word with reverse order

I'm doing an exercise where I have to do the given word with input exit in reverse order. I start by counting the number of letters that have the word entered (commented in the code). After having counted the number of letters in the word I...
asked by 22.12.2016 / 01:43
3
answers

Doubt regarding pointers in C

void imprime (char *v, int n) { char *c; for (c = v; c < v + n; v++) printf ("%c", *c); } I have this function, but I do not understand what it is doing exactly and how the pointers behave in this case.     
asked by 28.09.2016 / 21:46
1
answer

Add days to date increasing via For

In the code below I add 1 to each step in the variable i , to add 30 days in the dt field, do I need another for or what to do in it? DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd = ADO_Utils.GetComando(cnx);...
asked by 23.04.2016 / 01:45