Questions tagged [credit.c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 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 ...
user avatar
0 votes
1 answer
49 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 ...
user avatar
  • 1
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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
35 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 ...
user avatar
0 votes
1 answer
61 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 ...
user avatar
1 vote
1 answer
94 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 ...
user avatar
  • 15
0 votes
1 answer
31 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 ...
user avatar
0 votes
1 answer
128 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 ...
user avatar
  • 107
1 vote
2 answers
146 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 ...
user avatar
0 votes
1 answer
123 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 ...
user avatar
0 votes
3 answers
1k 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 ...
user avatar
0 votes
2 answers
83 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 ...
user avatar
1 vote
1 answer
445 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 ...
user avatar
1 vote
1 answer
499 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 ...
user avatar
0 votes
1 answer
85 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.
user avatar
0 votes
1 answer
67 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 ...
user avatar
  • 11
0 votes
1 answer
63 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: "); ...
user avatar
  • 25
0 votes
1 answer
66 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) { ...
user avatar
0 votes
1 answer
120 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 ...
user avatar
0 votes
1 answer
356 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 ...
user avatar