Questions tagged as 'while'

4
answers

how can I use input validation to request a positive number and continue the program?

I would like an output like this: (I would prefer to use only while and Boolean expressions if possible.) escribe un numero: -50 debes usar un numero positivo! escribe un numero: -200 debes usar un numero positivo! escribe un numero: 200 esc...
asked by 30.10.2018 / 01:47
1
answer

SQL While traversing a table

Friends I'm trying to run a table from SQL but for some reason I do not get the data for each row of my table. Can someone tell me what I'm doing wrong? declare @count int = 0, @countb int = 1 set @count = (select count( * ) from sta...
asked by 22.08.2018 / 22:34
1
answer

++ in front of variable inside of a while - Language C

int bandera; while (++bandera != 1) { bandera--; } I do not understand the code of ++bandera != 1 . Does it mean that +1 is added to the flag and then fixed if it is different from 1?     
asked by 25.09.2017 / 06:05
2
answers

"While": how can I "print" the values of while in horizontal separated by a ","?

I would like to be able to print the values that you send me: c=int(input("Ingrese un numero:")) a=0 while(a<=c): print(a) a+=2 instead of one on each line:    > > > Enter a number:   9   0   2   4   6   8   ....
asked by 28.04.2017 / 19:26
1
answer

C ++ error when making an input with cin or getline (std :: cin, var) returns a loop when writing with spaces or a v

When requesting data and placing a space, when using cin > > temp.name ;, it gives me an error that causes a loop of the 2 while at the same time or, when using getline (std: cin, temp.name);, the question jumps to me. The code is as follo...
asked by 12.12.2018 / 19:15
1
answer

PHP-Reorder Array

I have developed an algorithm in php to reorder an array that I have, the code is as follows: <?php $idescuelas=[4,5,8]; $newalumnos=[]; $sql="SELECT * FROM pruebas_alumno inner JOIN alumnos on pruebas_alumno.id_alumnos=alumno...
asked by 09.05.2018 / 16:45
1
answer

Do I need to create a grid with random numbers from a while loop?

I need to create a grid of 8 elements with the name of the items, the quantity and the price with random numbers, I have done this but I do not know how to form the grid. <?php $i = 0; while ($i == 8) { $i = rand(1,100); echo $i."<br&g...
asked by 15.04.2018 / 09:05
1
answer

Join while with for to fill in html table for working hours

I need to create a pdf with the record of a teacher's day. I have the table Schedules with (id, idTeacher, Day, HoraIni, HoraFin, Fecharegis) Being the Dia - > 1 = Monday, 2 = Tuesday, 3 = Wednesday ...) This is the code that I have to genera...
asked by 06.03.2018 / 16:36
1
answer

WHILE does not work

necesito que si tipo == "LATA", no entre al ciclo, pero igualmente lo hace private static String ingTipo() { System.out.println("Ingrese tipo de envase"); String tipo = scan.nextLine(); while (tipo != "LATA") {...
asked by 24.09.2017 / 23:11
2
answers

How many conditions can I add in a while loop?

I start in the programming and I come to your help. I made a while loop which responds correctly when I add a condition, however when I add a 2nd condition the loop goes into an infinite cycle even though the conditions are true and must co...
asked by 25.07.2017 / 18:12