Questions tagged as 'while'

1
answer

Difference between algorithms that read numbers until you receive the number 999

What's the difference between these codes? First code: cont = 0 n = 0 total = 0 n = int(input("Digite 999 para parar")) while n != 999: n = int(input("Digite 999 para parar")) cont += 1 total += n print(total) Second code:...
asked by 14.12.2018 / 20:00
2
answers

insert a cursor within a while in android

In android I have a cursor where it looks for the data in the database and perfectly returns the data but .. How do I insert a second cursor into the first one? to pull data from a second table My code try { StringBuilder sbQ...
asked by 20.12.2017 / 07:35
2
answers

What is the error in this loop?

I want to download an .exe file from my FTP server, but it has a part in the code that is giving me trouble. Error: Invalid expression term 'while' (CS1525) Can anyone tell me what's wrong? FtpWebRequest request = (FtpWebRequest)WebReque...
asked by 10.09.2017 / 17:15
1
answer

Why does this infinite loop happen?

I made this code but it is looping infinite and I can not fix it ... #include <stdio.h> int main (){ int x, z; while("x=100; x!=65; x-=5"){ z=x*x; printf("%d --> %d\n", x, z); } }     
asked by 10.10.2017 / 05:17
3
answers

While loop - number counter minus 0

Good evening! I need to apply a loop for the user to always enter a number (via prompt), when typing 0 should appear an alert stating the number of numbers entered, not counting zero. I'm not understanding what I'm doing wrong, as it is di...
asked by 28.01.2017 / 06:45
1
answer

How to transform a while structure in for? And vice versa? [closed]

I'm needing an explanation on how to transform a structure in while to for and vice versa. Thanks in advance for any help!     
asked by 28.04.2016 / 04:02
1
answer

how to group result mysql while inside table html php [closed]

Good afternoon someone can give me a light I'm trying to organize the data within the while, now I can get the data and put it in the normal table so my problem is when there are many items inside a volume of it gets repeated a lot of time the n...
asked by 09.07.2017 / 22:32
1
answer

Doubt while while

I have the following code: # -*- coding: utf-8 -*- def soma(lista): soma_num = 0 while soma_num <= lista: soma_num += a return soma() a = [1, 2, 3, 4] print(soma(a)) I know that it will give error in line 7 and 10, s...
asked by 22.06.2016 / 07:13
1
answer

Javascript + PHP

Hello, I need your help; I have my While in PHP listing all the materials, their quantities and a space where the Total is calculated as the quantity of the product increases. Here's my PHP: <?php $dadosMat...
asked by 03.04.2016 / 03:50
1
answer

IF within the while PHP / MYSQL

I'm listing some results within the while so my goal is that when any of the variables that cleverly in the while come empty, it list only those that come with content. ps. is a poll system, I put to register 4 answers, but some questions onl...
asked by 02.03.2016 / 15:35