Hot answers tagged

1 vote

credit pset1 cs50 sum while loop

A problem I found is at line 47 of the code (the second while loop): while (power <= 14) { sum += (number % 10); power += 2; number = number / pow(10,power); } I think you meant the ...
Ricardo David Antonetti's user avatar
1 vote
Accepted

Why does this become an infinite loop?

The infinite loop lies here: while(j < rows) { printf("#"); (i++); } The loop depends on the value of j being updated and eventually not less than rows. Since j is never changed ...
Cliff B's user avatar
  • 68.7k
1 vote

While Loop in C only executing once and then stopping

So after you get an error message that says "Out of Range", when you try to enter another value that is out of range, the loop stops. There is a "clearKeyboard()" function that is called in here - ...
bbNicky's user avatar
  • 11
1 vote

clang doesn't like while loop

Error message is caused by your ; after int main (void), making it a function declaration rather than a function definition. For a function definition, a code block in curly braces follows that line, ...
Blauelf's user avatar
  • 20.9k
1 vote

while loop not working

Credit to Kareem for answering this question, but it has been 4 months and it hasn't been posted as an answer... in the interest of improving the CS50 knowledge base, I'm posting the answer here. (I ...
Dr.Queso's user avatar
  • 253

Only top scored, non community-wiki answers of a minimum length are eligible