Questions tagged [pset1]

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

Filter by
Sorted by
Tagged with
-1 votes
1 answer
36 views

Error: format specifies type 'char *' but the argument has type 'char **' [-Wformat]

I am learning C and I am stuck on this, probably because I am dumb but idk #include <stdio.h> int main() { char name[25]; int age; printf("whats your ...
OMAB2infinity's user avatar
1 vote
1 answer
12 views

pset1 cash compiles but gives unexpected outputs

I'm having trouble figuring out why I'm getting the outputs that I am. I tried to write a function that I can re-use for each denomination of coin, not sure if the problem is there or somewhere else. ...
if_indeed's user avatar
0 votes
1 answer
19 views

Can someone help me understand why we multiply the quarters by 25

// Subtract the value of those quarters from cents cents = cents - (quarters * 25);
Victoria's user avatar
1 vote
2 answers
60 views

Problem With Check50 for problem set "Credit"

I'm currently working on week 6 python and the problem sets are the same to that of pset 1 just with python instead of C. So when I decided to write it I saw that my code in C was extremely bad so I ...
Calapsy's user avatar
  • 13
1 vote
1 answer
29 views

CS50x PSET1 Credit <class 'pexpect.exceptions.EOF'>

So regarding Pset 1 Credit, I'm having this issue with Check50 My code identifies the card, but there's some error when input given at shorter length: My code are the following: #include <cs50.h&...
Blacov.'s user avatar
  • 11
0 votes
1 answer
123 views

help fixing the spaces on mario's pyramid

I need some help figuring out how to change the number of spaces on each line of the pyramid. The pyramid comes out with 5 spaces at the beginning of each line instead of 4, then 3 then 2, etc. I ...
AmyG's user avatar
  • 41
0 votes
1 answer
13 views

CS50 problem set_0 is talking about recording a 1-3min intro of presentation of yourself before submitting your Scratch project

==> SO I'm wondering, do I really need to record my self ? ==> or what if I don't ?, what's gonna happen, I won't be able to submit successfully ? my problem is I'm not comfortable talking in ...
Oliverson's user avatar
1 vote
1 answer
11 views

PSET 1 Cash - How to reject negative input?

I'm using a do..while loop in the get_cents function, which has worked for me in the previous problems. What makes this program incorrect? #include <cs50.h> #include <stdio.h> int ...
Elij's user avatar
  • 21
1 vote
1 answer
33 views

CheckSum in credit pset1

as in the code given below i want to multiply 1 by 2 then delete it and so on but i don't how to do that i made the first steps to delete the last number by using %10 then show it with the /10 i hope ...
Ahmed Hussien's user avatar
-1 votes
2 answers
27 views

PSET1: Receiving archive: cash.zip checkir error: cash exists but is not a directory unable to process cash/

Please see attached snippet below. I am having difficulty creating the 'cash' folder or directory. I have followed all the command prompts from 'cd' through 'wget https:' as shown in the cs50 ...
bdxltk35's user avatar
1 vote
1 answer
42 views

Credit : the checksum is correct for <10 digits, but for14,15,16 digits getting negative checksum

The checksum is correct for less than 10 digits but for 14-16 digits it is coming back negative. What am I doing wrong? #include <cs50.h> #include <stdio.h> #include <math.h> int ...
Parth Munjal's user avatar
0 votes
1 answer
34 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
32 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
0 votes
1 answer
31 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
26 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
18 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
26 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
1 vote
2 answers
131 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
  • 13
0 votes
2 answers
43 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
40 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
16 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
45 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
24 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
81 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
160 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
29 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
52 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
1 vote
2 answers
2k 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
43 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
242 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
45 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
2k 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
60 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
24 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
40 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
1 answer
110 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
37 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
26 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
70 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
478 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
32 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.
LKizza's user avatar
  • 1
0 votes
1 answer
48 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
1 answer
19 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
21 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
147 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
41 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
81 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
51 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

1
2 3 4 5
24