Skip to main content

Questions tagged [credit]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
0 votes
0 answers
2 views

Code for problem set one, Credit not working

I have completed the other set one problems, and wanted to test myself with "Credit". I read through the problem and walk through and wrote code that I believed would work. I tested the code ...
John Goossens's user avatar
-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
0 votes
1 answer
30 views

Week 1 Credit, two visa cards #s not working

I've been stumped on Credit for a few weeks, I've learned a LOT in writing my code and I have fixed many errors. My code now passes all the checks except for these two errors and I cannot figure out ...
msx68010z80'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
0 answers
35 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
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
2 answers
48 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
41 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
1 answer
33 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
121 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
40 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
52 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
98 views

credit.c I don't understand how to fix my code

I've been trying to figure out what's wrong with my code. I used printf so I could confirm whether or not the value of N is correct but it's coming out as completely different as what I would expect ...
maira's user avatar
  • 1
0 votes
2 answers
118 views

Pset1 credit, checksum value gives wrong value

I find myself stuck on credit. Can't figure out where the problem lies in my logic. Checksum gives 4 where it should give out 0. Ideas appreciated. //calculate checksum value int sum1, ...
turbulenttangles's user avatar
1 vote
1 answer
86 views

Week 1 - Problem concerning question on 'credit'

Consider: #include <cs50.h> #include <stdio.h> int main (void) { //User's Input long n = get_long("Number: "); int sum_of_odds = 0; int sum_of_evens = 0; ...
Felix Chen's user avatar
0 votes
1 answer
150 views

CS50 problem set 1 CREDIT works sometime but not always

I am very new at coding and taking CS50. I am currently working on the credit problem in week 1. I finished coding but when I ran check 50 my code only seemed to work for some of the card numbers and ...
Julia Velloso's user avatar
1 vote
1 answer
333 views

problem with credit with this numbers (369421438430814 & 5673598276138003)

I just finished solving the credit problem and regularly used check50 to see my results, and then this happened. check50 sees that these numbers : 369421438430814 5673598276138003 are invalid, even ...
Yassen Redwan'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
36 views

Recalling the function for output changes the input

#include <stdio.h> #include <cs50.h> #include <math.h> int procedure (int array[] , int length); int input_length ( long input ); int main (void) { long card = get_long("...
MWD's user avatar
  • 86
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
46 views

I have to enter any letter to get the result

I am currently doing the problem set 1 credit in cs50 program. I managed to write the code. It's compiles fine however once I enter the credit card number it stops, i must type any letter to get the ...
Mana Tahir's user avatar
0 votes
1 answer
118 views

Credit Card Check

So I am on pset6 trying to implement the credit card check. I've already completed working through the numbers and am not having any issue with the actual algorithm. But for some reason my if ...
Multiplify'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
107 views

pset6 credit help with calculations in python

I am trying to convert my credit solution from C to python, but for some reason it is not working. Attached is my code and the problems from cs50 import get_int card, a, m, v = False, False, False, ...
Bob Tan's user avatar
0 votes
1 answer
48 views

Pset1 Credit - Why is my code bypassing the Floor function inside If statement?

Here's my code- int f_1 = floor(N / 1000000000000000); int f_2 = floor(N / 1000000000000); int f_3 = floor(N / 100000000000000); int f_4 = floor(N / 10000000000000); if (...
VooDooDarkMagic'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
0 votes
1 answer
65 views

credit pset1 bruteforcing doesn't work

I was trying out credit and tried to write a code for all 15 digit cards so if a AMEX card exists it should work in theory. However even with valid cards I'm getting the input invalid. I have not ...
FoundABetterName's user avatar
0 votes
0 answers
137 views

Can anyone help me troubleshoot my code for the CS50 Credit problem? (**not trying to cheat, just need some help!)

This is the code I have written in c for the cs50 credit pset 1 problem. I am checking the length of numbers entered, and the first digits (AMEX 15 digits, starts with 34 or 37; MC 16 digits, starts ...
AbbiePBC's user avatar
0 votes
1 answer
47 views

trouble summing the sides on credit

I have made it to the point it separates every digit into two sides so as to have two different sums, but then It gives me the wrong value of the sum. I'm pretty sure there is a bug in therms of it ...
paula.em.lafon's user avatar
0 votes
1 answer
92 views

Question about Pset1 - credit

I had work on the credit for 3 hours, and I had reach to most of the function - and I checked that the number received from: Luhn (a) last digit(c) and digit count (cc) are right by using ...
Anti-Entropy's user avatar
0 votes
1 answer
130 views

PSet1 Credit Invalid VISA that shows as Valid. My checksum must be wrong but dont know why

*/Here is the error I get: :( identifies 4111111111111113 as INVALID expected "INVALID\n", not "VISA\n" :( identifies 4222222222223 as INVALID expected "INVALID\n", not &...
melval's user avatar
  • 1
0 votes
1 answer
75 views

PSET6 Credit - checksum not giving the correct number

list1 = list(input("Number: ").strip()) even_count, odd_count, count = 0, 0, 0 # if the length is even if len(list1)%2 == 0: # iterating each number in list for num in list1: ...
Anurag Reggie's user avatar
0 votes
2 answers
128 views

PSET 1 Credit; Sometimes Check50 works and other times it doesn't

Why does Check50 work for certain credit numbers and not others? I ran debug and found that for some credit numbers and not others it may randomly be always one away from a multiple of 10 preventing ...
Anon's user avatar
  • 5
0 votes
1 answer
39 views

Week 1 Credit; Not Creating Variable

I'm starting the week 1 credit problem, however, when trying to set together every second digit it simply does not print. Could you help me identify where I went wrong? Thanks! #include <stdio.h>...
Anon's user avatar
  • 5
0 votes
1 answer
2k views

I keep getting "expected EOF" when I use check50

this is the message identifies 4111111111111113 as INVALID expected EOF, not "INVALID" this is the code #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
Gloria Isedu's user avatar
0 votes
1 answer
213 views

My code is not compiling

my code isn't compiling and i don't understand the error message #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> bool checksum(string credit); ...
Gloria Isedu's user avatar
0 votes
1 answer
30 views

When I multiply my array by 2 it doesn't give expected value

Also, please when I try to add "firstnumsum", it doesn't give expected value and I don't know what to do. #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
Gloria Isedu's user avatar
0 votes
1 answer
97 views

i don't know what's wrong with my code. Trying to convert from string to long

INPUT int main(void) { long long cardnumber, calc; string credit[0]; string nonnumeric; //long long calc = card number; int countcardcharacters = 0; long long c; //user input do { credit[0]= ...
Gloria Isedu's user avatar
1 vote
1 answer
33 views

Making code neater: a way to reduce repeated logical operators?

For CS50 pset1 Credit I'm using repeated logical-OR operators (||) to work out the validity and card brand of a credit card number. When I evaluate the style of my code using style50 it says to insert ...
 kittensyzygy's user avatar
0 votes
1 answer
1k views

How do you find the first digit of a long number?

I wrote the following code to try to find the first digit of a long number (this is for the CS50x "Credit" exercise), but it's not working. Any tips? // Conditions and relational operators #...
 kittensyzygy's user avatar
0 votes
1 answer
42 views

ProblemSet1 - Another Credit.c issue - Can't convert the floating value of my variables into an integer value

I was almost finishing my code when I got stuck with a strange problem. I've asked a question a few hours ago and someone answered, so I manage to fix that issue. But unfortunelly I got stuck in ...
KevinWGS's user avatar
0 votes
1 answer
39 views

ProblemSet1 - Credit.c - Issues assigning the sum of the numbers on a variable

So I coded the first lines of the Luhn's Algorithm and tried to print the values of some of my variables to be sure they were doing exactly what I want it. For my surprise they weren't. And I were ...
KevinWGS's user avatar
0 votes
1 answer
199 views

PSET1 - Credit: Check50 says wrong what should be right

Someone with the same problem? I have a 16 digit number starting with a 4 and my code identifies it correct as VISA\n, but the check50 says it has to be INVALID\n. What could cause this strange ...
Grisu's user avatar
  • 3
0 votes
0 answers
91 views

I can't get the Luhn algorithm to run properly in my code

#include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { long long cardnumber = 0; //Prompt the user for the credit card number using get_long do { ...
wilburch's user avatar