Questions tagged as 'for'

2
answers

For inside For (Explanation)

I went back to studying logic, since I was only studying front-end and it struck me a very rough doubt about one from another. for (var i = 1; i <=10 ; i++) { for (var i2 = 1; i2 <=10; i2++){ document.write(i); }...
asked by 19.02.2018 / 02:10
2
answers

Write each step of calculating a factorial

I have a piece of code that calculates the factorial of a number in JavaScript, but I wanted it to return the steps of each calculation, eg:    3! = 1x2x3 = 6 Follow the code I made. I tried to "print" decrementing the variable, but I'm n...
asked by 31.05.2018 / 06:10
2
answers

How to filter an array using the For structure?

How can I filter an array using the for structure? The code is this: const numeros = [1,2,3,4,5,55,190,355,747,1000,125];    I need to filter the numbers under 10. I used it this way, but I was asked to create one using the...
asked by 23.01.2018 / 01:59
1
answer

C / How to change the for for a while?

Write the function prints using the while repeat structure instead of for. If necessary I can edit and insert all the code. void imprime(Ccc *p) { Ccc *r; for (r = p; r!=NULL; r = r->proximo) printf("%c",r->caracter); }...
asked by 29.08.2018 / 14:25
2
answers

For looping

I'm getting the values from the array and trying to pass it on, but it eventually goes into loop and bringing the values 1,2,3,4,5,6 .... array_push($var, $linha['data']); array_push($var, $linha['data_th']); array_push($var, $linha['data_fl...
asked by 29.08.2018 / 21:04
2
answers

How does Length and Out of For in Javascript work?

I have a constant question about Length and loop for to measure an array or string. Doubt 1: When we use this code: const numero ="teste"; const medir = numero.length; console.log(medir) It returns the value...
asked by 31.01.2018 / 00:27
2
answers

Erasing rows from bottom to top

I'm using the method innerHTML(); to display 60 lines on the page. As soon as I need to delete 20 to 20 lines to each click on the button. Full source code: for (i = 0; i <= 60; i += 1) { document.getElementById("...
asked by 19.05.2016 / 10:14
1
answer

Sort list with Python + Django

Good afternoon guys, I'm having a problem, I've registered for the django admin a video that should be sent to my template, but I need these videos to be sorted by the position field I have in my models.py in the bank models.py...
asked by 27.09.2018 / 16:30
1
answer

How to compare a string from an array in C?

I have the following variables: char nome[10][8]; int i; --> Sendo esta para o loop I ask the user to enter 5 names and then I read the variable: printf("Entre 5 nomes : \n"); for(i=0; i< 5 ; i++) { scanf("%s",nome[i]); } But aft...
asked by 29.03.2017 / 07:55
2
answers

Error while running program

#include<stdio.h> #include<math.h> int main ( void ){ int x; int i; printf("Input the number (Table to be calculated) : "); scanf("%d", x); for( i = 1; i <= 10; i++){ printf("%d x %d = %d", x, i, x*i); } return 0; }...
asked by 20.12.2016 / 01:23