Questions tagged [credit]
140
questions
0
votes
0
answers
25
views
pset1 credit.c file EMPTY?
this is my first question in this community.
I just downloaded the zip file for pset1, problem credit (more comfortable)
is the file actually empty ?
could it be that I did something wrong?
thank you ...
0
votes
1
answer
56
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 ...
0
votes
0
answers
56
views
PSET1 Credit error mistake
Hope this finds you well. I am having a little bit of trouble with PSET 1s credit problem, the code compiles fine but when running check50 it gives me a few errors.
I tested one of the errors, where ...
0
votes
2
answers
72
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, ...
0
votes
0
answers
73
views
CS50 Pset Credit
After working on this problem for 5+ hours I was able to get the code working. After I summitted it, I looked at other peoples solutions, and most of them were very different than mine. Is the style ...
0
votes
1
answer
59
views
Week 1 - Problem concerning question on 'credit'
#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;
int count = ...
0
votes
1
answer
48
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 ...
0
votes
1
answer
87
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 ...
0
votes
1
answer
62
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 ...
0
votes
1
answer
29
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("...
0
votes
1
answer
44
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 ...
0
votes
1
answer
33
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 ...
0
votes
1
answer
81
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 ...
0
votes
1
answer
44
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 ...
0
votes
1
answer
88
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 ...
0
votes
1
answer
76
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 ...
0
votes
1
answer
73
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, ...
0
votes
1
answer
41
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 (...
0
votes
1
answer
70
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
0
votes
1
answer
53
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 ...
0
votes
2
answers
101
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 ...
0
votes
1
answer
38
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 ...
0
votes
1
answer
78
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 ...
0
votes
1
answer
73
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 &...
0
votes
1
answer
66
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:
...
0
votes
2
answers
71
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 ...
0
votes
1
answer
30
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>...
0
votes
1
answer
645
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 &...
0
votes
1
answer
107
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);
...
0
votes
1
answer
24
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 &...
0
votes
1
answer
70
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]= ...
1
vote
1
answer
31
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 ...
0
votes
1
answer
230
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
#...
0
votes
1
answer
39
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 ...
0
votes
1
answer
36
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 ...
0
votes
1
answer
102
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 ...
0
votes
0
answers
88
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
{
...
0
votes
1
answer
91
views
Need help (or idea) making the code looks cleaner. (PSET1/CREDIT)
My code passed pset1/credit but I still think the there must be a way to make my code looks cleaner and more impact. If you have any idea please criticize the code. Thank you in advance.
#include <...
0
votes
1
answer
71
views
HELP ME!! CS50 pset1 credit.c says INVALID but when I debug it says AMEX?
#include <stdio.h>
#include <cs50.h>
int main(void)
{
long long cc;
//get user input for cc
do
{
cc = get_long_long("Number: ");
} while (cc <= 0);
/...
0
votes
1
answer
47
views
CS50 Credit - again a scope problem
I think I almost finished the credit problem set, however, I have another scope problem. I think it is really simple.
After the checksum, the code is not working anymore. If I put extra braces by the ...
0
votes
2
answers
121
views
Credit pS1: how to store the seperate digits and store them
Thank you for the answers. I think that I made some steps. The problem now is that I can't store the seperated digits. It only stores the last one in "remain". My other challenge is that seperating ...
0
votes
1
answer
20
views
Scope problem - not print the test results
I have trouble with my scope (PS1, credit) I am using two while loops and to test the result, i print results in between. This code does not print the second printf. I think it is a scope problem but ...
0
votes
0
answers
85
views
Stuck by problem set Credit, % operator
As a beginner I am stuck in de problem set Credit. Especially the % function is giving me trouble
To better understand it, I tried to use the example of programming simplified to get the sum of digits....
0
votes
1
answer
72
views
pset6 credit the sum is not end with zero and check count right how
the Luhn’s Algorithm in 378282246310005 = 48 and in 371449635398431 = 76 so how not INVALID
it must end with zero so the two number must be INVALID
0
votes
1
answer
69
views
Pset 1 Credit - trying to use count to solve the problem but returns 0
I am trying not to use Arrays to solve this problem. However, the answer keeps showing as 0. Can someone pls help to explain?
Thanks a lot in advance!
Below is the code: I am trying
1. get the ...
0
votes
1
answer
44
views
Check50 giving different results from the code I compiled in pset1
For Problem Set 1, I have the code as written below
#include <cs50.h>
#include <stdio.h>
int card_length(long cNo);
void luhn_algo(long lacno, int lacnolen);
void finalPrint(int cardDet);...
0
votes
1
answer
70
views
I am not getting the correct output when i enter David's card number in credit
This is my code:
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
int x, y, z, p, q, r, d, e;
int k = 0;
int s = 0;
long A;
long n = ...
1
vote
1
answer
438
views
credit - Why this AMEX and MASTERCARD numbers are considered invalid?
I have compiled my version of credit, anyway check50 throws 2 fails during its check. Lines with numbers where it fails are:
:( identifies 369421438430814 as INVALID
expected "INVALID\n", not ...
0
votes
1
answer
3k
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 ...
0
votes
1
answer
66
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 ...