Questions tagged [pset1]

The problem set for Week 1 introduces the C programming language.

Filter by
Sorted by
Tagged with
0 votes
1 answer
20 views

Relational comparison unused in pset1 cash

I have a relational comparison unused and my code fails to compile. int get_cents(void) { // TODO int cents = 0; do { cents = get_int("Total cents owed: &...
deertom's user avatar
0 votes
0 answers
22 views

What do you think about my code here?

#include <cs50.h> #include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { long long credit_num; credit_num = get_long_long("credit number: "...
انس رفعت OR. ANAS REFAT's user avatar
-1 votes
0 answers
14 views

cash does not work anymore

Yesterday, my code worked. Today, the code doesn't work anymore. Both times I tried check 50. Yesterday everything was alright but today it wasn't. What happened?
user40089's user avatar
0 votes
1 answer
22 views

PSet 1 Mario Less - cube instead of expected stair

I was expecting to see this code print out the stair with the dots, as suggested by the pset instructions. But this is printing out a square, like David's code. But why? What should I do here? for ...
Moyak's user avatar
  • 1
0 votes
1 answer
13 views

For Loop to look through all values of an Array

So, I am learning C using cs50 and a problem I have run into is that although i have yet to learn about arrays, I need to use arrays for my problem set. I would really appreciate it if someone could ...
molearns's user avatar
0 votes
0 answers
16 views

Methods to run code not working

Whenever I try the ./ method to run the code, it simply doesn't work and keeps telling me its a directory. How else am I supposed to complete the course if the fundamental motor to run the code won't ...
Will Hoover's user avatar
0 votes
1 answer
21 views

How to Solve : expected identifier or '('

here is my code: #include <stdio.h> #include <cs50.h> //Declaring User-Defined Functions int last_digit(int sum3); int main(void) { //Promting the user for credit card number ...
molearns's user avatar
0 votes
2 answers
46 views

variable used in loop condition not modifies in loop body

im struggling with pset1 cash exercise, when im defining a calculate_quarters() and other in the same way i got an error. the task is to find out the number of quarters, dimes, nickels and pennies to ...
liza's user avatar
  • 3
0 votes
2 answers
34 views

pset1-credit I can't find the issue with my code

the program prints invalid for valid card I know that my mistake is probably really dumb, but I can't find it (sorry for bad english) #include <cs50.h> #include <stdio.h> int main(void) { ...
Hecos's user avatar
  • 3
0 votes
1 answer
31 views

pset1 credit 2023 , do while loop with arrays/intervals

#include <cs50.h> #include <stdio.h> int main(void) { long n; do { n = get_long("13 digits or at max 15, 16 card number: "); } while(n < ...
REJEN RJ's user avatar
0 votes
0 answers
15 views

Unpredictable counter behavior - pset1

I am working on the problem set 1, the credit problem. My plan is to split the user entered number into individual digits, and put them in an array. To start int l = 0; // length of number int count = ...
Camel old's user avatar
0 votes
1 answer
34 views

What can I add to my code to solve the practice problem set 1 week 1. The question is giving the prime numbers between the inputs minimum and maximum

bool prime(int number) { // TODO int newnum = number % 2; if (newnum > 0) { return number; } else { return false; } return number; }
Paul DP's user avatar
0 votes
1 answer
16 views

I'm getting a floating point exception error in the credit code but I definitely haven't divided by 0

Here is the code: int sum1(long long n) { int sum1 = 0; int x = 0; for (long long i = 100; (n % i) <= n; i *= 100) { x = 2 * ( ( (n % i) - (n % (i / 10)) ) / (i / 10) ); ...
Certified Bibliophile's user avatar
1 vote
0 answers
57 views

rejects invalid populations and then handles population 20

#include <cs50.h> #include <stdio.h> int main(void) { int n; int End; // TODO: Prompt for start size do { n = get_int("Start size: "); } while ( n < 9); // TODO: Prompt for ...
SAMIM Amiry's user avatar
1 vote
2 answers
132 views

I don't what number means in PRIME/LAB1

everyone, I've stuck with this problem for a few days, I found some kind of resolution for it, but I don't understand what means number. I will really appreciate if anyone can explain me more
Juan Alberto Chocca's user avatar
0 votes
1 answer
28 views

Getting "use of undeclared identifier" and can't solve it without ruining my code

i've been working on the mechanism to get every other number of the credit card number, and this is what i've come up with so far: int get_credit(void); int check_sum(int number, int a); int ...
Harr's user avatar
  • 35
0 votes
1 answer
41 views

pset 1 mario less comfortable

I don't know how to put the dots. In walkthrough we are told come with formula but I don't know how to come up with formula. I have no idea what to do. }
Shah Hassan's user avatar
0 votes
1 answer
487 views

cs50p problem set 1 - meal.py (don't understand prescribed structure)

I don't understand the purposed of the last two lines in the prescribed structure / how to format program in this structure. Prescribed structure: def main(): ... def convert(time): ... if ...
Jack Maxwell's user avatar
0 votes
2 answers
34 views

PSET 1 - Mario Less - Missing one last thing

I am missing one thing in the code because it's printing me the dots in every height case.. Can anyone give me a hint how to solve that ? int main(void) { int n; do { n = get_int("Height: &...
Nervossom's user avatar
0 votes
1 answer
190 views

Week 1 Lab 1 Population size

Im currently working on Lab 1 regarding the population size of llamas, and everything went smoothly however even though I am in the population_size folder and inside the file population.c right now, ...
Shawn Lim's user avatar
0 votes
1 answer
38 views

pset 1 mario style

I don't understand what is wrong about the style. Style50 indicates there is a problem with "int height" and "printf(" ");" in the k inner loop. Can someone explain what ...
IDeRouck's user avatar
0 votes
1 answer
1k views

CS50 Lab 1: Population Growth

I am stuck at this one. I just need somekind of a hint to move on I guess. I do not want to take a look at "Walkthrough". I need help with for loop. I cannot think of any condition that ...
Nervossom's user avatar
0 votes
1 answer
47 views

this program is supposed to be greedy algorithms that meant to count the number of coins to make the change owed = 0 , the output is always less by 1

#include <cs50.h> #include <stdio.h> int get_cents(void); int calculate_quarters(int cents); int calculate_dimes(int cents); int calculate_nickels(int cents); int calculate_pennies(int ...
ssan's user avatar
  • 3
0 votes
1 answer
21 views

Submit50 giving different results from manual input

Doing the population growth (Week 1 Lab 1), and here's my code: #include <stdio.h> int main(void) { int start = 0; while (start < 9){ printf("Start size: "); ...
Sunraj Patel's user avatar
0 votes
1 answer
33 views

My pset1 (cash) code compiles but the outputs are wrongs. Could you Help me?

This is the code: #include <cs50.h> #include <stdio.h> int get_cents(void); int calculate_quarters(int cents); int calculate_dimes(int cents); int calculate_nickels(int cents); int ...
Santiago Misas's user avatar
0 votes
0 answers
8 views

what is this and why this is showing from a long time i dont know the reasom plz help me

problem came after rebuild don/t know what's the issue hope you will help me
Bisaka Shrestha's user avatar
0 votes
0 answers
18 views

i can not see my mistake here i feel code should be correct can you please help

#include <cs50.h> #include <stdio.h> int main(void) { // prompt for height between 1 to 8 int height, row, column, space; do { height = get_int ("Enter height: &...
shane's user avatar
  • 3
0 votes
0 answers
28 views

CS50 PSET1 MARIO Pyramid inverted

I am beginner in coding. I have drafted the code to build 1 pyramid for Mario. However, it's coming inverted... Any ideas? int height; do { height = get_int("Height: "); }...
Sky's user avatar
  • 1
0 votes
1 answer
78 views

pset1:Credit (always outputs INVALID)

Whenever I input any card number into the program it outputs INVALID. I think the issue has something to do with not finding the first digits (int fdig) correctly because I used a print function ...
Ben Archbold's user avatar
0 votes
1 answer
36 views

there is a logical error I can't really catch up with

Output: Results for cs50/problems/2022/x/credit generated by check50 v3.3.7 :) credit.c exists :) credit.c compiles :) identifies 378282246310005 as AMEX :) identifies 371449635398431 as AMEX :) ...
thefriendlyg's user avatar
0 votes
1 answer
16 views

In my CS50 mario program I'm getting an error which shouldn't be happening (C)

I have a program which it is supposed to print Mario-like towers on each side corresponding to the amount you input. Everything seems to work but when I try to check the code it gives the error ":...
Brian's user avatar
  • 3
1 vote
1 answer
60 views

Problem with check50's result for pset1 mario less

I think my code can correctly print the pyramid,but it result errors in check50. What does that error in check50 means? Results for cs50/problems/2022/x/mario/less generated by check50 v3.3.7 :) ...
123ewqeins's user avatar
1 vote
0 answers
369 views

CS50py meal problem set 1 please help:)

This is my code for meal in problem set 1, when i manually input times the returned answer is correct but when i do check50 it says "Did not find "7.5" in "Breakfast\r\nI..."&...
Shiwoo Lee's user avatar
0 votes
0 answers
26 views

Text is invisible in terminal

I can't see anything I type in my terminal. I can type a command + enter and the command is executed but still not see the text this happens every time I open VS code.
labisi K's user avatar
0 votes
1 answer
43 views

Output problem credit

Finished my credit problem, whit the code below, but when I check it with check50 everything fails despite the output on the terminal being correct when I check manually. Code: #include <cs50.h> ...
harndt's user avatar
  • 1
0 votes
2 answers
60 views

am stuck at calculating quarters in the greedy algorithms

i am new to coding. how do i calculate after input of the user how many quarters they get then remainder to go next function
Abdullahi Omar's user avatar
0 votes
1 answer
16 views

how can i get for it reprompt if the user types negative integer or number more 8 . my code does the oppoiste of what i want it to do how do reprompt

I want to prompt user for range to print something but if it user puts negative or more 8 to reprompt.
Abdullahi Omar's user avatar
0 votes
1 answer
20 views

PSET1: Greed algorithm not printing not returning numbers requiring pennies

My cash program won't return number that require pennies. For example, 5, 10, 15, 20, etc. will work fine, but 1, 2, 3, 4, 6, etc. will not print. I am guessing there is an issue with something ...
pc510895's user avatar
0 votes
0 answers
11 views

when loop is given number like this i<333000000000000

it can't process the same, probably it's a bug .this is the snippet of my code. if you see the terminal you can notice when printing meow it, again and again, is twitching. I request to please look ...
Aryan Goel's user avatar
0 votes
1 answer
112 views

Dealing with pset1's "credit" problem

I was trying to solve this problem. I did some coding: #include <cs50.h> #include <stdio.h> int get_digit_number(long card_number); int main(void){ bool valid; long card = get_long(&...
user8633459's user avatar
0 votes
1 answer
38 views

Error in compiling hello

When i try to compile hello.c i get the error that vis studios thinks the file is named studio.h
Alexandra Bartee's user avatar
0 votes
0 answers
69 views

CS50 Cash 2022 - Functionality / Prompt Bug

*I am incredibly new to all of this, it's possibly operator error due to lack of familiarity with the software I actually understand the math and the set-up of the code, but I don't understand VS code ...
Olivia's user avatar
  • 1
0 votes
1 answer
14 views

Timed out and Pattern changes

I have two issues with my program. When I command check50 I have "timed out while waiting for program to exit" in different lines of my program. I've already searched for an answer to solve ...
José Cuacés's user avatar
0 votes
2 answers
49 views

pset 1 mario less. My Code is printing in single row. I cant find what wrong with it

#include <cs50.h> #include <stdio.h> int main(void) { int n; do { n = get_int("Height: "); } while ((n < 1) || (n > 8)); for(int i = 0; i &...
Prateek Chaturvedi's user avatar
0 votes
1 answer
56 views

Pset1 Mario-More. When i try to compile it says "height" is uninitialized and i need to give it a value but isnt that what the "get_int" is for?

#include <cs50.h> #include <stdio.h> int main(void) { //get height int height; do { get_int ("Height: ");} while ( height <1 || height >8); // for (int y = ...
asanaya91's user avatar
1 vote
1 answer
51 views

tilde ~ not showing in ssh set up

I've started Pset 1 and I'm currently implementing my codespace. After executing ssh-keygen, I have to execute cat ~/.ssh/id_rsa.pub. However, the tilde '~' does not appear in the vscode terminal and ...
Maria's user avatar
  • 21
0 votes
1 answer
509 views

CS 50 Pset 1 cash: non-void function does not return a value

I have finish a program and it can run smoothly on other platform like replit... But one I run it on vs code it shows the following error and it also have something weird happen when I run check 50 ...
the-great-potato's user avatar
0 votes
1 answer
287 views

check50 issue on Problem Set 1: cash [duplicate]

I have finish my cash homework enter link description here But I face an issue that I can't check it even when I run the program successfully. My code is as below: #include <stdio.h> #...
the-great-potato's user avatar
0 votes
4 answers
2k views

Cant get Codespace to work

Im up to the "Hello" module, week 1. Ive never programmed before so setting up copespace has been quite frustrating. I cannot get it to work. Can someone please help me? I want to get ...
Tamz Hamz's user avatar
1 vote
1 answer
227 views

Check50 and style50 not working: pset1

I am getting this error when I am trying to use check50 or style50. Please help me with this. hello/ $ hello/ $ check50 cs50/problems/2022/x/hello Traceback (most recent call last): File "/usr/...
Naveen sharma's user avatar

1
2 3 4 5
24