# Questions tagged [pset1]

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

186 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
457 views

### for loop mario.c

This is what I have for Mario.c less comfortable. I am having a problem printing the pyramid. Am I suppose to have a for loop for every space, #, and newline. for everyline. #=1 #
141 views

### looking at why jenny's number is not a isbn number

I am looking at the problem and I was wondering how come jenny's number is not an isbn number, the sum adds to 253 and it is divisible by 11. I am kind of confused here
639 views

### How to approach Pset1 Mario problem?

So far I am able to get input from user and print the amount of rows using a loop, but after that i am stuck. after this, i just don't know how to approach adding an extra # starting on row 2 and ...
79 views

### pset1 greedy.c check 50 programm error

I am wandering around for answers. But I end up that my code is correct ( I'm 90% sure :P ) #include <cs50.h> #include <stdio.h> int main(void) { double change; do { ...
132 views

### greedy algorithm

#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(); ...
48 views

### Pset1 I cannot print the correct amount of coins returned (greedy)

I'm trying to solve the less comfortable problem set of week1. I believe I'm somewhat on the correct road (at least i can get a return number). From how I implemented my code, it seems that when I ...
76 views

### pset1 greedy – get as results ten digits numbers *SOLVED*

I implemented my greedy with modulo and it works for many numbers but not for 0.01 and 0.15 :( input of 0.01 yields output of 1 \ expected output, but not "2058567041\n" :( input of 0.15 yields ...
99 views

### Need Coding style help - pset1 credit.c - (style50 failed to parse, feels and looks messy)

Style50 fails to even parse the code and it feels messy and cluttered. Need coding style pointers. Check50 passes. Trying to get the most out of this course, not just fumble through. What is wrong, ...
473 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 ...
79 views

### Understanding for loops and lingering questions I need answered before moving on!

I coded this and it passes. I just want to understand it much better than I do at this moment. I got hung up on a few of things and found the solutions online to those questions I was having but I ...
94 views

### Mario and Greedy programs can't pass the test

I will start talking about mario, because i can't see anything incorrect with it. So, here we go: This is my codeline: and here is some inputs/outputs (i believe it is working correctly): However, ...
134 views

### so im working on skittles pset and

skittles.c:6:1: error: expected identifier or '(' { ^ this is my error and this is my uncleaned up code #include <stdio.h> #include <cs50.h> int main(void); { int tries = (0); int ...
166 views

### CS50: Bad Credit - pset1 hacker1: Program compiling but not executing

the following code for CS50's hacker edition Bad Credit is compiling but is not executing. Would really appreciate a review: #include<stdio.h> #include<cs50.h> #include<math.h> // ...
274 views

### Stuck on Mario Pset1

I'm stuck on Mario Pset1. I keep receiving line breaks, and the function seems to skip the nested for loops. #include <stdio.h> #include <cs50.h> int check(int b); int checktwo(int b); ...
32 views

### What is the differnce (if any) between #inclide <libraryName.h> and -l[library]

the title is the question: What is the differnce (if any) between #inclide and -l[library] when using clang in the terminal
37 views

### function definition

#include <stdio.h> #include <cs50.h> int AnimalCategory(int); //function prototype int CurrencyCategory(int); //function prototype int ScienceCategory(int); // function prototype int ...
102 views

### Incrementing values using variables

This is my code for incrementing either positively or negatively but somehow the code compiles but dosen't work. #include <cs50.h> #include <stdio.h> int main() { int Ini, Con, Incre;...
76 views

### Can someone tell me what is wrong with my code?

Can some one tell me what is wrong with this code?this code is giving me error in the cs50ide. #include<stdio.h> #include<cs50.h> int main(void) { int i,height,n=1; do { ...
28 views

### trying out my code

#include <cs50.h> #include <stdio.h> int main(void) { // ask user for input printf("What time is it: "); int x = GetInt(); { if (x == 12) { printf("...
426 views

### Greedy loop problem

I'm struggling with the "greedy" assignment from pset1. I tried to use division to get the amount of coins needed and modulo to get the remainder, wrote code with loops, it compiles and runs, it gives ...
257 views

### Pset1, Hacker1,Credit.C, error while converting long long into an array

TL;DR Why does METHOD2 below work and not METHOD1?? I'll preface this with saying that after hours of trial and error, I got the code to work. However, I am still VERY CONFUSED as to why one method ...
22 views

### Is usage of many header files will increase the memory usage?

In my program I had used four header files, but actually I need only two. Does that consumes more memory or is it is an overhead?
524 views

### check50 is getting a different result from me on mario

I have tested every criterion of Mario, and they all are met, but check50 is getting a different output than me. Here is a transcript of what happened. elephant1123@ide50:~/workspace/pset1 \$ ./mario ...
159 views

### I can get the correct height for my pyramid but I can't get the spaces or #s to add or subtract properly in my loop

{ for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { printf("%d\n", j); } for (int k = n; k < n + 2; k++) { printf("#"); } printf(" \n"); return (0); }
342 views

### Pset1 Greedy problem

I thought I had made the right code the behind my logic was to first divide the number with 25 and keeps on dividing it until the answer is less than one which means it cannot be divided any further ...
195 views

### Still needing help with Mario pyramid construction

I can't figure out how to make the pyramid work. My current code from the //create pyramid onward is: //create pyramid for (int k = n; k+1<n; k++) printf("%d", k); printf("#"); ...
279 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 ...
133 views

### Mario syntax error

Something's wrong with my function declarator, and i have a different error that I don't understand at all. Please help! Here is the code: #include <stdio.h> #include <cs50.h> int n; ...
204 views

### Mario pset1 a little hand please!

Spoiler alert code inside this link! !http://imgur.com/OIHvPFC I am having trouble with the mario, any tips of how i can get on with this? I have listed my integers at the start but maybe i over ...
163 views

### I have a error during compilation of pset1 water.c

Any idea why this error is showing clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow water.c -lcs50 -lm -o water
702 views

### mario.c; error message: expected identifier

I have been trying for more than a week to correct compiling error: mario.c:19:1: error: expected identifier or '(' The response I received did not help. #include <cs50.h> #include <stdio....
133 views

### Pset1 No rule to make target 'water'

I wrote my code and I am using the appliance online. The appliance version is 19 so even though this question has been asked about mario and hello, there are no instances of the water pset found. ...
288 views

### I'm having trouble printing the hashes and spaces. I've started with this, but it doesn't seem to work. Any ideas?

My code is down below. Everything above the for loop is fine. I need help with printing spaces and hashes. #include <stdio.h> #include <cs50.h> int main(void) { int h; do { printf("...
252 views

### pset1 Mario trouble

I've been working on this for days now, and have reached a point where I'm afriad I've gone further away from the LOGIC of the problem. At the moment, the complier doesn't print out line 16 and yet ...
117 views

### pset1 check50, help with the code [time for a change] all outputs are correct except one

All the outputs are correct except one. Tried for loops, while loops, even if loops, but it won't just solve the problem. :< [code edited away per academic honesty guidelines] harvard@ide50-...
254 views

### Why does “compiles” fail when checking with check50?

In the instructions, they were using Dropbox. I don't have Dropbox, so what should I do? update: Now I got my way through until the actual check. The 'exist' part is green (yay) but the compile part ...
52 views

### virtual machine doesn't power on

i just installed cs50 appliance but when i tried to power on the virtual machine this message appeared anyone can help me please?
69 views

### Typing hashtag in gedit using a mac keyboard

I've already changed my keyboard layout to English (UK) as per these instructions (Configure appliance for QWERTY layout (UK)). Every key is now correctly assigned except for hashtag, which on my ...
332 views

### pset 1 mario space help

I am having a problem printing the spaces. The code I have gets the number as required. It prints out the number of hashtags desired based on user input. However, there are no spaces. Where can I ...
141 views

### pset1: greedy Correct output when run in terminal but check50 shows different output

I am really frustrated with this error. I have been try all day, changing my code here and there but nothing works. Plz help me..
368 views

### Debugging problem caesar cipher pset1

I need some help with my debugging for the caesar cipher. I get these errors. [image replaced with actual errors produced by the code that follows] caesar.c:25:17: error: incompatible integer to ...
254 views

### Cannot submit PSET1

I recently finished PSET1 and I am unable to submit through the following website: https://newapps.cs50.net/cscie50/2015/@/submit/review/axis/10735 I am taking the CS50 course via Harvard Division of ...
178 views

I can't understand what's wrong with the code. I've changed it many times, but errors are always similar.Can anyone please check the code and tell what's wrong?
161 views

### User input on Mario-isn't asking to retry

I'm wondering if this is the correct code for getting the user input for Mario. It isn't asking the user to "retry", but just asking for an integer over and over until it meets the parameters. ...
315 views

### VMware Fusion Product Key

I have downloaded VMware Fusion and more or less followed all the instructions provided, yet I could not locate the product key to activate the software. Does anyone know where I could find it?
73 views

### What is exactly greedy.c do?

I have no idea where to start and how does it support to work! I never seen it such as that thing in the picture that is in assignment! You may see me as stupid person, but I have no idea how is work ...
113 views

### pset1 greedy simple version doesn't work

So I was trying to start off my greedy code with a simple part thereof... I am trying to simple get a float... then if it is more than 25 cents, subtract 25 cents from it, and add 1 to my count... ...
137 views

### I can't compile my code for pset 1 and I don't know why

I don't know what the problem is, it says the error was the lack of an "expected identifier or '('"