Skip to main content

All Questions

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

CS50 Week 1 credit card problem set

I am having trouble debugging my code. The logic looks right to me, but whenever I try running credit card test numbers, my code will only sometimes correctly identify the card type. I have tried ...
Oliver Mai's user avatar
1 vote
2 answers
96 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
40 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
1 vote
1 answer
49 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 vote
1 answer
52 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
30 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
1 answer
29 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
1 answer
145 views

Need help with the Credit Problem for Week 1

I have signed up for this year's CS50x, and I am stuck on the problem where we are meant to validate a credit card. The problem requires that we check the amount of digits, the first digits and use ...
Vedant 's user avatar
0 votes
1 answer
69 views

credit pset1 cs50 sum while loop

I was doing the credit problem with the visa test card in the page: 4003600000000014 It passed that test, however in other tests it doesn't pass. I think it's a matter of the sum that it can't compute ...
Thom OM's user avatar
0 votes
1 answer
89 views

PSET 1 Credit Card Checksum doesn't add up

I'm having my issues finding the right answer as this is non code related. The checksum says: "If the total’s last digit is 0, the number is valid!" This is a credit card number that is ...
Joesns's user avatar
  • 3
0 votes
1 answer
183 views

Credit (Pset1) - Checksum problem

so I have a problem with the Credit exercise from pset1. I updated my code today after realizing that I didn't split up the digits of the product of the current digit in the card number and 2 and ...
PrimeBeat's user avatar
  • 137
0 votes
1 answer
113 views

My do-while loop does not work

do { number = get_long_long("What is your credit card number? "); } while((number < 1000000000000) || (number >= 10000000000000000)); This loop is not accepting inputs. I do not ...
bobthebuilder's user avatar
0 votes
1 answer
88 views

pset1 credit: I am unable to identify what's wrong in the logic of my code?

Kindly tell me what mistake have I made in this program? pset1 Credit: (my code) https://pastebin.pl/view/5646dbf1
AnishGhule-Technogeek's user avatar
1 vote
1 answer
9k views

error: result of comparison against a string literal is unspecified (use strncmp instead) and Check50 showing error on credit problem

I've submitted my credit problem after testing with possible values and everything seems to work just fine as planned, except that I got some errors that certain numbers could not be tested as INVALID ...
KeleosWilliam's user avatar
0 votes
1 answer
72 views

What is probably wrong in this while loop?

I'm getting positive integers from users. I used a do-while loop to check and validate that the user input is: 1. A positive integer. 2. The length (I.e size) is between 13 and 16 digits BUT NOT ...
KeleosWilliam's user avatar
1 vote
3 answers
144 views

Why is this while loop generating errors

I'm trying to get a 15 or 16 digits numbers (integers) from users and then using a do while loop to check if the user entered a valid number, otherwise, they will be re-ask to enter the number. THE ...
KeleosWilliam's user avatar
0 votes
1 answer
48 views

pset1:credit, multiplication problem

for some reason my program doesn't multiply (card_number % 10) * 2 for example when card_number % 10 = 6 the output is 6 instead of 12. for(int x = 0; card_number != 0; x++) { if (x % ...
kylekibet's user avatar
0 votes
1 answer
2k views

pset1 | error: invalid operands to binary expression ('long long *' and 'int')

Here are snippets of my code: long long card = get_long_long(); long long *FindLength = *card; while (FindLength != 0) { FindLength = FindLength / 10; counterCardLength++; } And ...
yuniFlaminjo's user avatar
0 votes
1 answer
60 views

Pset1: Error when trying to assign single digits of int variable to array using for loop

I'm currently working on Credit. I'm trying to find the first two digits of the card number using a for loop. I've created an array named firstdigits with two elements. Then I've created a for loop to ...
yuniFlaminjo's user avatar
0 votes
1 answer
1k views

How to find the length of a number

I'm working on Credit and am at the point where I have completed all the required calculations on the credit card and now need to find out if the final sum ends in zero or not. I think that in order ...
yuniFlaminjo's user avatar
0 votes
1 answer
407 views

PSET1 / Credit / Modulo problem / Error: invalid operands to binary expression ('double' and 'double')

I have a problem with a modulo in “Credit”. That is a part of my initial code: #include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { //...
Olga's user avatar
  • 28
0 votes
1 answer
134 views

Problem with my credit.c code

My credit.c code keeps inserting huge numbers in my array for seemingly no apparent reason. For example the user enters 45231 for the credit card number, the beginning of the array is fine and ...
Christopher Lee's user avatar
0 votes
1 answer
191 views

pset1 problem with digit acquisition

I'm working on credit in pset1 and I'm having problems with getting every other digit. I opted to use arrays and fill them using for loops (as shown below) but for whatever reason the output is ...
ParzivalBlade's user avatar