Skip to main content

Questions tagged [pset1]

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

Filter by
Sorted by
Tagged with
5 votes
1 answer
2k views

How long to wait for being graded

How much time does it take to get our psets checked? It's been more than two weeks since I submitted my pset1, yet it hasn't been graded. (I am doing CS50x)
MSA's user avatar
  • 51
1 vote
5 answers
9k views

What's wrong with my code for mario?

I've been stuck on pset1 for five months now. I like to do things chronologically and mario has been giving me headaches. Every time I think I have the problem solved, I'm told it's wrong or a lot is ...
user1175's user avatar
0 votes
1 answer
261 views

pset1 - "greedy" failing at one value

So, I just finished typing my "greedy" code for the fifth time and thought that this time it actually works, but when I run the check it fails at only one value 4.2. I'm going to post my code and hope ...
PetarNPetrov's user avatar
26 votes
1 answer
8k views

Greedy.c works for all numbers except 4.2

When testing greedy.c, all numbers appeared to work except 4.2 (annoying since 4.2 is in the check50 test). I get 22 coins instead of 18. I printed my variables at each stage of the problem and ...
Shiraz Butt's user avatar
3 votes
1 answer
144 views

My output for greedy.c is correct when I check it manually but not when I check it using check50

It says that ' input of 4.2 yields output of 18 \ expected output, but not "18" '. What is the difference between 18 and "18" ?! Here is my code: #include <stdio.h> #include <cs50.h> ...
Manya Agarwal's user avatar
0 votes
1 answer
538 views

greedy.c program compiler errors

I am a novice regarding compilers. Can somebody explain to me what the following printed errors mean? Since I was not sure whether I will be violating the Honor Code, I have not included my greedy.c ...
uma1966's user avatar
  • 199
1 vote
1 answer
2k views

Why does an input of 4.2 yield an output of 22 not 18?

I did all good in check50 .. except this one thing in greedy :( input of 4.2 yields output of 18 \ expected output, but not "22\n" This is my code
Khaled Alba.'s user avatar
0 votes
2 answers
1k views

no such file or directory

I am trying to begin pset 1. I followed the instructions in the pset. After saving the file hello.txt, i execute the commands to open the file in the terminal by typing cd dropbox/pset1. I get the ...
user1476's user avatar
0 votes
2 answers
764 views

No rule to make target hello

I typed the program of problem set 1 and get the error message No Rule to Make Target hello. I run ls and I see hello.c in my dropbox pset folder. See screen shot.
Travel636's user avatar
0 votes
3 answers
690 views

Mario Pyramid - Check50 - Unexpected end of input

Does anyone know what this means? I'm getting the correct output from my program and this is the only message I get from check50.
Phillip's user avatar
  • 15
0 votes
1 answer
319 views

pset1 Greedy can't compute pennies

I'm encountering some problem with my code with regards to pset1 Greedy! For some odd reason my code can't seem to compute pennies? So whenever i put in any values that has a 0.01 it won't calculate ...
Joel Tan's user avatar
3 votes
1 answer
38k views

C syntax errors like "expected expression"

I completed an introduction to programming using Python and I am more used to Python then C, so I might mix the two up. C is giving me all kinds of errors. I tried changing things but noting seems to ...
zoot404's user avatar
  • 35
3 votes
3 answers
4k views

Stuck on PSet1: I have the correct output, but Check50 says it's wrong

I'm stuck on the Mario part of PSet1. I've managed to write up my program and the output is always correct (or at least seems to be to me). I know it's definitely the loops that are making things ...
cursue's user avatar
  • 35
2 votes
1 answer
214 views

How do I fix the precision error for convering float to int?

I'm taking the input via float f = GetFloat(); I enter 4.2 I multiply it by 100 and print the integer and I get 419. This is my output O hai! How much change is owed? 4.2 n=419 22 How do I ...
user1291's user avatar
2 votes
1 answer
9k views

Stuck on pyramid for mario.c

I have the first part of mario.c done. The computer asks the user for input and then continues to ask if the user does not input an acceptable number. However I am unsure of how to print the #'s and ...
Corith's user avatar
  • 23
2 votes
1 answer
281 views

check50 rejects greedy even if the correct answer is displayed

When I run check50 on pset1 it does not validate my solution, even if it says that the expected output is the same as the correct output. Does anyone know what the problem is?
Alfredo Chavez's user avatar
2 votes
3 answers
796 views

Getting error in pset1 mario more

In pset1 mario more problem i'm getting these errors. I don't understand the errors and how to correct this. :( handles a height of 2 correctly \ expected output, but not " # # \n## ##\n" :( ...
Israt's user avatar
  • 23
2 votes
3 answers
814 views

Why don't I get the correct result when dividing numbers for greedy?

I was trying to use the remainder operator (i.e.,'%') to get the remainder, but I ran into an error: n % 25 is not evaluated to 23 when the input is 9.73. Am I doing something wrong here? Or is it ...
PranavM's user avatar
  • 21
1 vote
3 answers
618 views

How to validate user input for greedy.c

How can I ensure that my program checks that a user enters a valid floating point value? I tried GetFloat but that only seems to return retry in the event that a user enters a non numeric value. If a ...
fuego pazzo's user avatar
0 votes
1 answer
2k views

make: *** No rule to make target `hello'. Stop

Im unable to run make hello - I have read through the other troubleshoot but unable to find out what iam missing. Please can someone help me if I have entered something incorrectly. Error make: *** ...
Aipou Chang's user avatar
0 votes
1 answer
281 views

What is wrong with this code for greedy (pset1)?

I have written the following code as a part of pset1 for greedy. I always seem to get a number less than the actual number of coins.Please help me out. #include <stdio.h> #include <cs50.h>...
Pranshu Dave's user avatar
0 votes
2 answers
2k views

How to build the pyramid in pset 1?

I'm stuck on the mario problem in pset1! How should I start going about printing the half pyramid? I already figured the user input part...
user1427's user avatar
0 votes
1 answer
422 views

Pset1 Hacker Mario has correct output but not passing check50

My Mario code for a double pyramid has the exact same output as the ~cs50 file. However, I can't get it to pass the check50 code. It seems as if the numbers 2-23 are not handled correctly, but again,...
ytma's user avatar
  • 29
0 votes
1 answer
195 views

Does greedy's Output Have to Match The One Required per the Pset Specification Page?

I'm trying to check my greedy program with check50. I'm wondering whether my output must match the one required per the pset specification page. Here's check50's output jharvard@appliance (~/Dropbox/...
Gaurav Singh Negi's user avatar
0 votes
3 answers
167 views

Greedy hangs after prompting for user input

I'm a bit stumped at what I'm missing in my Greedy solution. The program keeps getting hung up right after the prompt for user input. Check50 doesn't give me much information to work from. What is ...
Mary Keenan's user avatar
0 votes
1 answer
1k views

pset1 cash 2022

hello guys I got en error from check50 2022 which you can see it in my screenshot I check it 100 times but I can't resolve the problem can you please help me? #include <cs50.h> #include <...
Dayan Mehrani's user avatar
10 votes
4 answers
82k views

Error: "make: *** No rule to make target `mario'. Stop."

I keep receiving and the error message " *** no rule to make target 'mario' stop" when I try to make mario. Does anyone have any advice? I already typed in pwd and I'm in the Jharvard desktop. Any one?...
Joseph Aaron Woodward's user avatar
5 votes
2 answers
19k views

Problem with "expression result unused" error in for-loop

There is obviously something missing in my understanding of the for-loop. Part of my code looks like this: int height; do { printf("Height?: "); height = GetInt(); } while (height < 0 || ...
Joseph Youren's user avatar
1 vote
1 answer
107 views

I'm stressed, someone pls help

why cant this code work? it works on everything in check50 except for 4.2 pls tell me whites wrong #include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { float ...
Brenda's user avatar
  • 23
1 vote
1 answer
65 views

Function in C: How to create

#include <stdio.h> #include <cs50.h> int main(void) { long creditcardno; do { creditcardno = get_long("enter"); } while (creditcardno < 0); } The above code accepts ...
Splendid Digital Solutions's user avatar
1 vote
1 answer
722 views

error: expected identifier or '(' with greedy.c

I've been working on greedy.c and received this error in terminal: greedy.c:23:1: error: expected identifier or '(' if cents > 25 ^ I thought it had something to do with the if...else statement I ...
SS''s user avatar
  • 113
1 vote
1 answer
132 views

How do I ensure that the user input in greedy is given to two decimal places?

I have a question about 'Greedy' in pset1. How do I ensure that the input I'm given by the user is in the correct format, namely to two decimal places like 0.00?
fuego pazzo's user avatar
0 votes
1 answer
264 views

Final line format for greedy OK but check50 says: expected output, but not "0\n"

As per the specifications for greedy, my final line of code just prints an integer followed by \n. printf("%d \n", answer) but I get the same output as check50 rejects greedy even if the correct ...
natolano's user avatar
0 votes
1 answer
682 views

pset1 cash.c check50 outputs 1 error?

I am receiving this output from check50 on pset1 cash.c :) cash exists :) cash compiles :) input of 0.41 yields output of 4 :) input of 0.01 yields output of 1 :) input of 0.15 yields output of 2 :) ...
JohnWick's user avatar
  • 155
0 votes
1 answer
82 views

Is there a way to replace the whitespace in the url whose part is some user input? i.e. User input contains whitespaces Pset1 (Wiki)

I'm doing a project of CS50's Intro to Web Programming with Javascript and Python(Pset1 : Wiki). While creating a new entry/page I'm asking the user for a title and content for the page. After which I'...
Abhyuday Vaish's user avatar
0 votes
2 answers
516 views

"Killed by server" at the check50 test: rejects negative input like -.1

When I upload my program to check50, everything is green except I get this one error: :( rejects a negative input like -.1 \ killed by server What do I need to do to fix this?
user1571's user avatar
0 votes
1 answer
100 views

Why Am I Getting These Symbols Printed Out?

I'm working on mario trying to print hashes and spaces, but rather I get these symbols printed out instead . Why am I getting these symbols? I'm using statements like these within my program to ...
iCS50's user avatar
  • 17
0 votes
1 answer
23 views

Credit problem: Opening parentheses not matched with closing

Though it might appear annoying, the program not compiling. To the best of my understanding, there is a closing parenthesis on line 37. Is it some cache related issue? https://drive.google.com/file/d/...
Splendid Digital Solutions's user avatar
0 votes
2 answers
193 views

Problemset 1-setting up pset1 directorory in dropbox

Problemset 1-setting up pset1 directorory in dropbox When I downloaded Appliance 50-19 version and double clicked on the icon Home nothing happens. Hence I am not able to set up the directory pset1 ...
uma1966's user avatar
  • 199
0 votes
2 answers
960 views

Compiler errors while using Clang [duplicate]

I have been using Clang Compiler and check50 to write the programs in pset1 i.e hello.c and greedy.c I have found that check50 appears to say that hello.c and greedy.c compile ,even though the Clang ...
uma1966's user avatar
  • 199
0 votes
1 answer
137 views

Compilation Errors When Compiling greedy

For some reason, even though I have declared the float variable change in my greedy.c program, the Clang compiler gives an error message saying that I have not declared it. Even with 3 compiler ...
uma1966's user avatar
  • 199
0 votes
2 answers
661 views

Why Does greedy Fail Passing check50 Tests? [duplicate]

I completed the code and ran the program. I get the desired results, but when I run check I receive the following red lines: :( input of 0.41 yields output of 4 \ expected output, but not "Number ...
David Zulkiewski's user avatar
0 votes
1 answer
434 views

Why Do I Get Errors When Checking greedy with check50?

I recently finished my greedy program and checked it out using different values and it appears to work except for large numbers (more than 6 digits) because of the float problem. So, I checked it ...
Jonobugs's user avatar
0 votes
1 answer
75 views

pset1 greedy check50 comparsion comes up with sad faces not sure why

So I'm unsure of why I'm getting the red sad faces :< It seems that my code is giving the same/correct answer.
Erin Price's user avatar
0 votes
3 answers
4k views

How can I add alternate digits in credit.c?

I am currently trying to solve the hacker version of pset 1 (credit.c). I have successfully completed the rest of the psets (hacker and standard versions). I need to sum up the even (starting from 0) ...
Happytreat's user avatar
0 votes
1 answer
149 views

pset1 credit: segmentation error

My approach is to take the user input in as a string, while forcing numeric input between 14 and 16 characters long. I think my code should do that, but I get a segmentation fault for numeric inputs ...
Avishai Fuss 's user avatar
0 votes
2 answers
113 views

Greedy algorithm1

#include<cs50.h> #include<stdio.h> #include<math.h> int main() { float f=0; long int a=0,c=0; printf("Enter the float value:"); do { f = get_float(); }while(f <= 0); a = (...
Arivezhil Namasivayam's user avatar
0 votes
1 answer
193 views

Gradebook issue

So far i have submitted PSET0, PSET1, PSET2, PSET3. I have submitted both standard and hacker editions. I have following grades so far: PSET0....................1.0 PSET1 PSET2...............
Laxman Rawat's user avatar
0 votes
2 answers
1k views

bash: ./mario: Permission denied in Mario problem pset1

I think I wrote my code correctly. I used the same algorithm in Java and it gave me the perfect output. Can someone please tell me what's not working for this one and why it wont even comiple? mod: (...
Mishel Sikder's user avatar
0 votes
3 answers
1k views

What is the difference between a library and a header file?

Specifically I'm confused about a line in an answer for another question (here: What does the linker do?) The #include pre-processor directive does not copy the code from libraries to your source ...
Alanna Dennis's user avatar