Questions tagged [for-loop]

The tag has no usage guidance.

8 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

PSET8 Web Finance - Index/Portfolio - Why do my for loop variables not pull over to Portfolio.html?

I have the below code for my application: #valid stock row queries valid_stocks_rows = db.execute("SELECT symbol, SUM(shares) as sum_total FROM ledger WHERE user_id=:user_id GROUP BY symbol ...
0
votes
1answer
25 views

Finance - Index showing correct number of rows but all the same record. For- loop issue?

So I've been looking at this all morning and can't figure what I'm doing wrong. All my variables are producing the correct values so it seems to be something to do with my For loop. In the html ...
0
votes
1answer
23 views

Hexadecimal to Decimal Conversion - Loop runs in reverse order (opposite to what is expected)!

The following code converts Hexadecimal numbers to Decimal numbers (successfully). I'm unable to figure out why the code behaves in just the opposite manner as it should be! I was planning to write: ...
0
votes
0answers
38 views

What is wrong with my code?

In this program I am trying to receive an input as a string using argv[] and then I am trying store corresponding values of argv[1][i] into an array var[i] using switch case and I am finally adding up ...
0
votes
0answers
450 views

I'm working on isbn.c. Here, instead of one 'yes', it's displaying several yes'es. What mistake did I make?

Why is my output showing 'yes' multiple times? I think it's because the values of 'num' and 'num1' are being run separately each time to make the value 'finally', but I'm not sure. Please help me fix ...
0
votes
1answer
271 views

Hacker pset1 credit.c always gives invalid?

I tried to attempt the credit.c problem. My code is as follows: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> int main(void) { printf("Please ...
0
votes
2answers
458 views

pset1 Mario. Spaces work, hashes don't and i can't see why

So I have been working on CS50's pset 1, making marios half pyramid. I have been looking over other problems on this site and I've gotten this far. But I can't seem to see what the problem is with my ...
0
votes
1answer
578 views

Problem with “expression result unused error” in for-loop?

I am getting an error message of "expression result unused" for the bottom two for loops (specifically h + 1 and s - 1). I've tried looking for through the other questions for an answer but nothing ...