Questions tagged [credit.c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
22 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
0answers
10 views

Why is my credit.c not outputing correct ans?

#include <math.h> #include <stdio.h> #include <stdbool.h> short unsigned int numlen(unsigned long long n); void isValidCC(unsigned long long int n); int main(void) { unsigned ...
0
votes
1answer
31 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
1answer
20 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
1answer
41 views

credit.c problem on some input nubers

Here is my final output to credit.c checksum = (checksum / 1) % 10; if (checksum != 0) { printf("INVALID\n"); } //Validation for American Express if (count == 15) { } //First Validation for ...
1
vote
1answer
61 views

cs50 pset1 credit expected expression error

So, I have gotten rid of all the errors and got the code to the point to prompt the user for the credit card number and output an answer the only problem is the program falls thru to invalid every ...
0
votes
0answers
22 views

Unknown problem in command line for credit of ps1

Hello fellow programmers, I've been trying to write code for the credit part of PS1 and the command line spits back the following: clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 ...
0
votes
1answer
30 views

Issue with credit.c assignment. Weird division by zero error in checksum function

I'm trying to work on the credit.c assignment by breaking it up into smaller tasks. Right now I'm trying to make a checksum function (eventually used to check the validity of a cc number). This is ...
0
votes
1answer
87 views

Credit.c works, but not completely?

So I finished credit.c today and was trying out different numbers from the paypal website the course provided and got some unexpected results and don't know what to do with it. When I type in valid ...
1
vote
2answers
131 views

error at while loop cs50 Pset1 credit

I am getting an error at while loop it says error: '&&' within '||' [-Werror,-Wlogical-op-parentheses] while((credit % 10 >= 0) && (i < 15) || (i < 16)) here is my ...
0
votes
1answer
106 views

pset1 - problem with credit ..help plz

I spent so many hours and still can't figure the problem, any guidance would be appreciated.. I checked against all the paypal test numbers and got same response as the staff's execution, though I got ...
0
votes
3answers
426 views

Credit Problem: what does “number’s second-to-last digit” mean?

In the example code on for the Credit problem, it says, Multiply every other digit by 2, starting with the number’s second-to-last digit, and then add those products' digits together. Moverover, the ...
0
votes
2answers
65 views

Problem with credit.c concerning if loops with multiple initial conditions

I am working on the credit.c code. I am trying to make sure that the number of digits and the first digits of each credit card number value that is entered correspond with the brand that credit card ...
1
vote
1answer
416 views

credit problem(pset 1) cs50

iam a beginner to programming and recently started cs50,in week1 there is a credit problem which stats: Implement a program that determines whether a provided credit card number is valid according to ...
1
vote
1answer
406 views

Credit.c is my nemesis

I have no experience programming, and English is not my first language so I'm struggling a lot with this particular problem. In "credit.c" you have to prompt the user for a credit card number and ...
0
votes
1answer
80 views

pset1 Credit: how to write it shorter

This is my code for the problem. [admin: hiding the code] It works properly but it looks hideous. I am looking for some nice inputs to re-write it in a more elegant way.
0
votes
1answer
51 views

Pset1 Credit keeps asking for input out of do-while loop

i'm new to programming so forgive me if I ask a ridiculous question. I'll be asking plenty of questions, but here is my problem with credit. I run my code, and it prompts me for a credit card number ...
0
votes
1answer
61 views

PSET1, credit.c compiles just fine, runs just fine. But when I use check50 everything goes to hell. Would love fresh eyes to look at my code

My code: #include <stdio.h> #include <cs50.h> int main(void) { long long i = 0; do { // read user input from stdin i = get_long_long("Enter credit card number: "); ...
0
votes
1answer
59 views

What is wrong with my credit.c code? Test it so you can tell what I mean

#include <cs50.h> #include <stdio.h> int main(void) { printf("Number: "); long long cc = get_long_long(); if (cc >= 4000000000000 && cc < 5000000000000000) { ...
0
votes
1answer
109 views

Something wrong with my credit.c code

I tried writing code for cs50 pset1's problem: credit.c(more comfortable) after week2. My code is given below. The problem is that 'sumx' and 'sumy' are just 0 and hence 'sum' is always equal to 0. So ...
0
votes
1answer
302 views

Credit task problem

I've just done "credit" task and it can't pass automated check by "check50 2016.credit credit.c" despite it passes manual check very well (I showed it below). I also add my code just in case. I have ...