Questions tagged as 'loop'

1
answer

How to create a copy of an element, through its property

I want to clone only the images whose attribute alt is "photo". Code var str = document.getElementById('A'); var clone = str.cloneNode(true); document.getElementById('B').appendChild(clone); <span id='A'> <p&...
asked by 25.03.2017 / 17:50
1
answer

comparison using c characters

Ok, the problem is only in function q31 and q311. link I left the complete code in the link above. so here's this q311 function: void q311(){ char forma; int n,jota,b,i,j; printf("Informe a figura e o tamanho: "); scanf("%c",&fo...
asked by 30.09.2015 / 18:42
1
answer

How to stop a loop using the input provided by the user?

I am writing a program that receives entries and creates a dictionary from them. I need the loop that I use to insert the entries in the dictionary to be broken when the entry is "9999", but it is not working. I'm doing this: dic = dict () dic...
asked by 17.04.2016 / 15:27
1
answer

Nested Loops and Increment

I am studying JavaScript by code house book and has a challenge involving nested loops, in which I have to draw this: * ** *** **** ***** ****** ******* Using this code: for(var Linha=0;Linha<10;Linha=Linha+1){ for(var Coluna=...
asked by 10.11.2018 / 21:18
1
answer

Applying Loop to Elements of a Matrix (R)

Be the matrix below created from the command simu_matrix <- matrix(runif(25,0,1),nrow=5,ncol=5) V1 V2 V3 V4 V5 1 0.07357303 0.45524021 0.9352829 0.60466424 0.4725541 2 0.51018615 0.46044203...
asked by 01.07.2014 / 16:01
2
answers

Undefined infinite loop no while

I made a program to calculate within a sequence the sum of the positive numbers and the sum of the negative numbers. When I use the command while , the idea is to be within a sequence of 7 numbers, and then the program exits from while...
asked by 05.10.2017 / 03:59
1
answer

Why use Kernel # loop instead of begin-end-while / until?

I'm doing a repeat structure in Ruby using the following structure: begin [código] end <while/until> [condição] But RuboCop , which I use as a linting tool, says that I should use Kernel#loop with break . So: loop...
asked by 03.12.2017 / 15:52
2
answers

How to report data in a vector

I can not report 10 student grades. import java.util.Scanner; public class exer { public static void main(String[] args){ Scanner scn = new Scanner(System.in); double[] N = new double[10]; int i; for(i=0;...
asked by 11.09.2017 / 08:31
2
answers

Create and assign variables in For loop

How to do this logic within a loop FOR ? var G1 = $('#G1').text() var G2 = $('#G2').text() var G3 = $('#G3').text() console.log("NaN") console.log(G1+"\n"+G2+"\n"+G3) console.log(G1+G2+G3) G1 = parseFloat(G1) G2 = parseF...
asked by 16.11.2017 / 17:29
1
answer

What's the difference between the "while" structure and repeat in VisualG?

What's the difference between the "while" structure and repeat in VisualG? Do you have an example?     
asked by 20.11.2016 / 16:44