How to validate a Credit Card number (Luhn algorithm | checksum) - C Programming

  Рет қаралды 50,379

BogdanBudaca

BogdanBudaca

Күн бұрын

Пікірлер: 164
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
If you enjoyed the video and what I am doing on this channel, consider buying me a warm cup of coffee ☕❤️ www.paypal.com/donate?hosted_button_id=R8EXVLT5HFBYE
@milesjohnson3432
@milesjohnson3432 4 жыл бұрын
Your pseudocode introduction is exactly what beginners need to understand this. Thank you so much.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad it was useful
@maayazed5316
@maayazed5316 3 жыл бұрын
I was struggling for DAYS on this particular problem set for a class. You're a lifesaver. The logic for the variables I just was not understanding, but it was put together so nicely here.
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad to hear
@twopaypal_f1
@twopaypal_f1 Жыл бұрын
just finished this problem all on my own. first time coding. so fucking proud of myself. your code is way cleaner than mine, but i'm still happy i was able to get everything to work and all the green smiley faces. keep the faith guys. you can do this even if you've never coded before. just don't give up.
@MagdaleneAlchemist
@MagdaleneAlchemist 2 жыл бұрын
Darling, i've walked to Mordor and beyond trying to find something like this! Thank you! this is just what i needed!
@hussainyunus2045
@hussainyunus2045 4 жыл бұрын
You are so sweet and soft-spoken. I loved your explanation as it was a million times better than my school teacher. Thanks and keep up the good work.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thank you, glad you liked it. It's usually good to browse over multiple resources on a topic I think, one might seem too much or too little and then with the next one(s) it starts to make more sense actually :) Keep it up
@valeriousmonk654
@valeriousmonk654 3 жыл бұрын
I'm beginner and this is exactly what I need. The best explanation video I've ever seen. Thanks a lot
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad it was helpful!
@adeyemibiola9763
@adeyemibiola9763 4 жыл бұрын
Thank you so much for this. I particularly enjoy how you explained the solutions/steps in the form of "pseudocode'' before implementation.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thanks Adeyemi
@f4r4g
@f4r4g 3 ай бұрын
It was fun to watch, especially where you made mistakes, thank you for this informative video.
@ExpandingBoundaries
@ExpandingBoundaries 4 жыл бұрын
With your pseudo code and explanation I started to work on my own implementation. After seeing it execute as it should be, I watched the rest of the video and took notes on your solution. Very different than mine, but I understand it very well after working on the problem myself! Thanks!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
That sounds awesome. Cheers, glad this helped some.
@dabinjeong9560
@dabinjeong9560 4 жыл бұрын
This is the first video of yours I watched, And I’m lovin it!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thank you so much , really glad
@jacquetrahan8481
@jacquetrahan8481 4 жыл бұрын
I'm very new to all this and taking the cs50 course at edx. I don't fully understand everything, mostly what certain codes do like why use strycopy vs printf each time, but i'm working on that. That said this helps dramatically understanding the logic as well as seeing you write everything done in the notes was awesome. Ill be watching it again after i further study the C language and hopefully be able to do it myself soon. Thanks again
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad it helps Jacque. Keep at it!
@saharjamialahmadi4964
@saharjamialahmadi4964 3 жыл бұрын
Thank you for the nice explanation. I fully grabbed the concept. Keep up the good job.
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad it helped!
@agutanful
@agutanful 2 жыл бұрын
Thank you so much! I was able to complete the task thanks to your initial explanation.
@daniruzsa1751
@daniruzsa1751 2 жыл бұрын
It s pretty nice to see someone experienced does it :D i managged to complate is in 3hour without help Just started cs50
@brunobmedici
@brunobmedici 4 жыл бұрын
Congrats bro!! Very clear explanation and features used in your code for beginners!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Cheers Bruno, glad you found it useful
@babatundekalejaiye7046
@babatundekalejaiye7046 Жыл бұрын
Great Video. I was initially getting a floating point exception error. I Had to change the divisor to a float data type, initialise it to 1 and count to minus 1, and all problems were solved. (c++)
@JixedUp
@JixedUp 4 жыл бұрын
This was a super useful explanation! Thank you, I was very stuck and seeing the pseudo code explaining the idea and then following along with your coding really helped!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad to hear, Ana, thank you
@LouisPinoPercussion
@LouisPinoPercussion Жыл бұрын
Thanks so much!!! I just wanted to point out that you can slightly simplify the addition of the 2 digit numbers by just subtracting 9 rather than using %. Adding digits of 14 is 5, 14-9 is also 5. This works for any number 10-19, then you subtract by 18 for numbers 20-29, 27 for 30-39, 36 for 40-49 and so on.
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Wouldn't this bring on too many 'if's I wonder?
@Azizaaly
@Azizaaly 4 жыл бұрын
very clear explanation of algorithms. thank you
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad you liked it, Aziza
@Eduardo-ii8lm
@Eduardo-ii8lm 2 жыл бұрын
Really helpful video! You explained the logic behind the Luhn's Algorithm very clearly!
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Cheers, Eduardo
@ammanchhetri6716
@ammanchhetri6716 2 жыл бұрын
Very good explanation 👌..thank u very much ... 🙂
@angelicaberistain8808
@angelicaberistain8808 4 жыл бұрын
Thank you very much for posting the complete process :)
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad you found it useful
@JDevshington
@JDevshington 3 жыл бұрын
Imma subscribe bruh...you just saved my semester with your explaination bro :3
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Cheers!
@user-sw1wq8lh2w
@user-sw1wq8lh2w 3 жыл бұрын
thanks for the suggestion on the / 100, this was where I was stuck
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Cheers
@lilacisblue8300
@lilacisblue8300 11 ай бұрын
This was truly helpful. Thank you so much!
@BogdanBudaca
@BogdanBudaca 11 ай бұрын
You're so welcome!
@billgatest7563
@billgatest7563 3 жыл бұрын
7 minutes in this is killer ty
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Cheers
@valeriasegura33
@valeriasegura33 4 жыл бұрын
Love how you explain, thanks so much!!!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thank you, Valeria
@ricardoneri4861
@ricardoneri4861 4 жыл бұрын
Subscribed thanks for the video! Great channel
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thanks so much, Ricardo, cheers
@seanclarito5934
@seanclarito5934 4 жыл бұрын
Thank you sir, you’re a great teacher!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thank you for the kind words Sean
@bhawanthachamod5521
@bhawanthachamod5521 Жыл бұрын
Thanks man, became very helpful.
@VinnieMarchisio
@VinnieMarchisio 2 жыл бұрын
I really appreciate the way you went through the problem. It was by far the easiest video for me to follow and understand the logic. Thank you for sharing it with us.
@yohanncooper8745
@yohanncooper8745 2 жыл бұрын
Appreciate the help. Thank you!
@2snish
@2snish 2 жыл бұрын
Thank you this helped me better understand the problem !
@boluemmanuel8999
@boluemmanuel8999 2 жыл бұрын
Thank you so much you explained really well and detailed 👍🏽
@ougininja8412
@ougininja8412 5 ай бұрын
Great explanation
@dubai_mal399
@dubai_mal399 4 жыл бұрын
Hi Bogdan, could you please explain role of the divisor here? Thanks very much for the walkthrough, it's super helpful!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi Malgorzata, thank you and glad you liked it. I will paste here the same details I wrote for another comment on the same topic, hope this helps a bit. The premise is that if our goal is to get let's say the first digit off a number, which does have some digits to it like a CC number, we can divide it by a certain factor of 10 (could've even been a factor of 1 for example and just do length, or in the demo's case digits 'count', minus 1 instead of 2). So what I mean by that is ask yourself, if I want the code to return 5 from 5678, I need to divide it by what number? 1000 - OK. So if the number has a digit count of 4, I can obtain the 1000 by multiplying 10 (what I've initialized the divisor to) by let's say 10, 2 times => so count of 4 minus the 2. Or if we initialize the divisor to 1, we multiply it by 4 - 1 instead of 2, so 3 times, by 10, to get 1 x 10 x 10 x 10 = 1000. Not sure if I'm able to be very clear, but hope this helps, let me know if not.
@paulo__vieira
@paulo__vieira 3 жыл бұрын
Great explanation ! It was really helpful. Thanks a lot ! ;)
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad to hear that!
@magschilaev1376
@magschilaev1376 4 жыл бұрын
this is a really good explanation. thank you! but I think it's confusing at 18:40 when you say that the loop would keep dividing by 10 until you get 0. you never get to 0, you just get a smaller number (e.g 0.1). it's only because you've got an int which ONLY takes whole integers as values, that this gets taken to mean 0. have i understood this correctly?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Yes Mags, totally correct, cheers. We look only at what's before the decimal point with the data type, thank you for the good spot
@alsayedabdelbaqey3585
@alsayedabdelbaqey3585 4 жыл бұрын
great work thanks a lot i finally understand the solution
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Happy to hear that :)
@igorsoares2250
@igorsoares2250 4 жыл бұрын
Thank you so much, i was try to solve this code a long time, but i wasen't see how to use the modulo operation . Thank you!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad you found this interesting!
@deepeshdhakal7476
@deepeshdhakal7476 4 жыл бұрын
thank you for this video. xx
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad you liked it
@abersan6520
@abersan6520 4 жыл бұрын
Thanks a lot for this. Was confused as I was sure I did it right but my code didn't add the product of the digits for case 2, only the products themselves
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Cheers
@MKSundaram
@MKSundaram 4 жыл бұрын
could you please explain the divisor part @23:47. I'm confused on that part. Why we are dividing in that way. Thanks
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi M K, It's just a tool to strip off the first, or first two digits off a CC number. It changes based on the count of digits of the CC number, and basically it just needs to know, for example, if the CC number is 5 digits long, we need to divide it by 10000 to get the first digit, and by 1000 for the first two digits. I iterate up to count - 2 because I've initialized the divisor to 10, could've set it to 1 and then iterate up to count - 1, you can just play around and tweak things as you need, just pick a small number and run it through to get the flow. Hope this helps.
@MKSundaram
@MKSundaram 4 жыл бұрын
@@BogdanBudaca Thanks. Keep up the good work.
@princesgallardo3431
@princesgallardo3431 3 жыл бұрын
Hi! I am learning this tutorial and very great explanation but in 23:21 why does in for loop the count needs to be subtracted by 2? the i < count - 2;? thank you so much for this vid!
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Thank you. I am trying to strip off the first, or first two digits off a CC number. The divisor changes based on the count of digits of the CC number, and basically it just needs to know, for example, if the CC number is 5 digits long, we need to divide it by 10000 to get the first digit, and by 1000 for the first two digits. I iterate up to count - 2 because I've initialized the divisor to 10 (and need it multiplied by 10 twice to get 1000 for 1234 for example etc.), could've set it to 1 and then iterate up to count - 1, you can play around and tweak things as you need, just pick a small number and run it through to get the flow. Hope this helps.
@mind4matrix
@mind4matrix 3 жыл бұрын
This is amazing bro What you did is a masterpiece
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Cheers
@nella1786
@nella1786 4 жыл бұрын
hello! I'd like to ask what is strcpy for? can't i put printf("credit card") instead in the last if else statements?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
With strcpy() we can pass in the different values, per case, to the 'result' variable. If we'd use just printf, we could just hardcode "credit card" and wouldn't even need the if checks, we'd know it's a CC, but not which type. www.programiz.com/c-programming/library-function/string.h/strcpy
@patrickmcauliffe7162
@patrickmcauliffe7162 4 жыл бұрын
great video dude!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thank you, glad you liked it :)
@thecryptographer55
@thecryptographer55 2 жыл бұрын
2:43 second step : I think in doubling must starting with 4 not 1 ??
@stellatee8920
@stellatee8920 3 жыл бұрын
Hi, can you explain why have to create this long workingCC = creditCardNumber; at line 15
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Hello, it's just to get a working copy of the CC to manipulate and chance as needed, and have the original untouched
@dawidblom1940
@dawidblom1940 4 жыл бұрын
Hi Bogdan, Great video and great way of doing this thanks a lot. I just have some trouble understanding the for loop you made for the divisor and the whole math going in it. Is it possible to go a bit more in depth with that part of the video? Thanks in advance.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi Dawid, glad you liked it. The premise is that if our goal is to get let's say the first digit off a number, which does have some digits to it like a CC number, we can divide it by a certain factor of 10 (could've even been a factor of 1 for example and just do length, or in the demo's case digits 'count', minus 1 instead of 2). So what I mean by that is ask yourself, if I want the code to return 5 from 5678, I need to divide it by what number? 1000 - OK. So if the number has a digit count of 4, I can obtain the 1000 by multiplying 10 (what I've initialized the divisor to) by let's say 10, 2 times => so count of 4 minus the 2. Or if we initialize the divisor to 1, we multiply it by 4 - 1 instead of 2, so 3 times, by 10, to get 1 x 10 x 10 x 10 = 1000. Not sure if I'm able to be very clear, but hope this helps, let me know if not.
@ilovezyp
@ilovezyp 3 жыл бұрын
Sorry, Why I input a valid card number the compiler show "Please input CC number : " again, it's not show the right card name, does anyone same problem with me?
@ilovezyp
@ilovezyp 3 жыл бұрын
Even I copy the github code, it's doesn't work, anyone can help me, please~
@ilovezyp
@ilovezyp 3 жыл бұрын
I finally found why, after I add long long front of variable , the problem solved, thx for the vedio!
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Cheers, Chou
@naturalremedieskonnect.7059
@naturalremedieskonnect.7059 3 жыл бұрын
I have experenced the same problem to three different youtube tutors with different working methods, i try as much as possible to be keen on how they ho every code along the way, by the time i reach at the bottom whenever i put in the name it only brings Invalid.
@abirsonet925
@abirsonet925 2 жыл бұрын
nice, really helpful
@AbdulRaheem-m1s
@AbdulRaheem-m1s 4 жыл бұрын
me yelling in my mind at 25:40" MAKE SUM = 0 " aaaaaahhhhhhhhhhhhhhh
@CheckmateStallioN
@CheckmateStallioN 2 жыл бұрын
Very solid video!👍 Only question I have is the last part why you decided to use a char array to store the string instead of simply just using printf("VISA")? It's much faster that way.
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
You're right, think that'd do it better, good catch 🙏
@anishacini762
@anishacini762 Жыл бұрын
why don't you just turn your long into a string and use strlen to get the length of your CC number, and then from the math library use pow, to get the first two degits : devide the cc number by 10 to the power of length - 2 ? i wanted to do it this way but i need to use pointers which i don't know how to use properly :')
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Oh that's an interesting solution, cheers
@NikolasMihalopoulos
@NikolasMihalopoulos 2 жыл бұрын
ive followed all the steps but for some reason when type my number then press enter it just goes down a line and doesnt say invalid or anything
@omardakkak7022
@omardakkak7022 3 жыл бұрын
I can't begin to describe how helpful this was, you make it look so easy. One thing I don't get is why did you do the extra steps in step 4 case 2. Why couldn't we just multiply the number by 2 and just immediatly add it to the sum. Would've that not worked if the result of the number times two was above 10 like 12 in your example?
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad it helped. The requirement for the algorithm is to add digits on every step, adding 12 to the sum instead of 1 + 2 = 3 would've taken things off track
@omardakkak7022
@omardakkak7022 3 жыл бұрын
@@BogdanBudaca Thanks
@lukasz070485
@lukasz070485 2 жыл бұрын
Hi Bogdan, thank you for the video. I am having the problem understanding the logic in around 23 min. For loop is quite complicated, why -2 and how is that divisor work ?? thx in advance
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Hey, Lukasz, maybe it might help if you come at it from trying to get the first digit of the number? This was one approach (maybe a bit weird I agree), for example start the divisor from 10, if you have 12345 - so length 5, if you start from 0 and up to 5 - 2, you get three iterations of 10 * 10 -> 10000, so 12345 / 10000 will give you the first digit.
@doodoopoo
@doodoopoo 4 жыл бұрын
Hi! I haven't watched the full tutorial yet because I'm trying to do it on my own, but I have a question: I have a variable n, which is the final sum. I tested it and I got 20 as the final sum. Then I tried to do final sum % 10, and I somehow got six! So n = 20. I put it like this just to make sure: long p = n % 10; printf("%lo ", p); Why did it print 6?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi, not sure why, should be 0, that's what I get if I try that
@guilhermerosa955
@guilhermerosa955 Жыл бұрын
I know that it needs to be like this in order to work, but can someone please explain to me the logic behind why does the divisor int needs to be initially declared as 10 and not 1? In my head it makes sense because if the do-while loop divided the ccnumber for the first time, shouldn't it be 10? Why does it already begin with 100 in the first loop. I know that I'm wrong but I can't wrap my head around why it is wrong lol
@faraz1605
@faraz1605 4 жыл бұрын
yes, good explanation But I am a beginner so need to watch again and again to get the things permanently in my mind. Also, it's a bit complicated for me.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
My mind also takes a while and some iterations to process things, I understand. Keep at it and it gets better, and don't forget this is complicated stuff, but worth learning :)
@naturalremedieskonnect.7059
@naturalremedieskonnect.7059 3 жыл бұрын
Hello Bogdan, i need your help, i have tried as much as i can to see that from you i can make this happen or my codes my print Visa , Master card, and AMEX but after finishing the code and try to test it, returns the output Invalid, regardless what i have done, and now i feel i exuhasted with this problem 2weeks on the same prblem almost all the people on youtube who tutor have failed but no help i can get from them.
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Don't give up and be patient, some inspiration from others might help, but I think it's best to grind through obstacles for personal a-ha moments.
@crazyphoenix5977
@crazyphoenix5977 3 жыл бұрын
Thank you so much ! It was really helpful. You explained the concept really well too : )
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Glad to hear, thank you
@mrzl_8424
@mrzl_8424 4 жыл бұрын
Hi, why do you use long instead of unsigned long long?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Good spot, cheers. Could've fined tuned that at least with unsigned, just went for less typing there I guess
@migueldelafuente1853
@migueldelafuente1853 3 жыл бұрын
Hello @BogdanBudaca!! Would you be kind enough to explain, please, why is it 'count - 2' in the loop: for (int i = 0; i < count - 2; i++) { divisor = divisor * 10; } This is the only part of the code I can't explain to myself, and would be grateful to hear from you on this matter. Thank you.
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
It's only a matter of how you want to work the divisor, you could try to initialize it by 1 and use count - 1, or by 10 and use count - 2. Say you have 1234 and you want to get the first digit, you would divide by 1000, right? So you would need to multiply 10 by 10, twice; the count being 4 for our example, I've deducted 2 from it to iterate twice, 0 and 1, up to 2. Hope it's not a weird explanation
@migueldelafuente1853
@migueldelafuente1853 3 жыл бұрын
@@BogdanBudaca Thank you; this explanation helped me to grasp a deeper understanding of the given operation; so, in the case of having a number 1234, while initialazing the divisor to 1, one'd have to multiply it 3 times, so the formula to run the loop those 3 times would inevitably have to be 4 - 1 (count - 1) to gather the first digit. Great! Namasté
@hounaidarebouh
@hounaidarebouh 4 жыл бұрын
Pleas i have the same exercise with C sharp i need help thx
@ChristmasSpirit23
@ChristmasSpirit23 2 жыл бұрын
De la ce vârstă ai început să programezi?
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
30
@gardenvariety-
@gardenvariety- Жыл бұрын
another way: #include #include #include int main(void) { long n; long cardn; int i; int sum1=0; int sum2=0; int lastn; int d; int count; long power; // request the card numner cardn= get_long("What is the card number? " ); printf(" "); n=cardn; while(cardn0); //Do addition of every other number starting from the number second to last after multiplying by 2 n=cardn/10; sum2=0; while(n>0) { lastn=n%10; d=lastn*2; if (d>9) { sum2=sum2+d%10+d/10; } else { sum2=sum2+d; } n=n/100; } int f=sum1+sum2; printf("the last digit in the sum is %i ",f); //know the number of digits n=cardn; for (count=0; n>=1; count++) { n=n/10; } printf("Total number of digits %i ", count); power=count-2; //just to know it is working printf("power is %li ", power); //know the first two digits//know invalid card n=cardn; power=count-2; long divisor=pow(10,power); printf("the divisor is %li ",divisor); printf("the remainder after dividing by 10 is %i ",f%10); if(f%10==0) { if (count==15 && (n/divisor==34||n/divisor==37)) { printf("AMEX "); } else if(count==16 && (n/divisor>50 && n/divisor
@josephhailey5155
@josephhailey5155 3 жыл бұрын
Wonderful, thank you! I am curious, however, in line 54 do you really need the conjunction? Since visa cards are the only ones that start with 4, can't we just use that condition alone? Anyway, thanks again, this tutorial helped me, immensely.
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Really glad to hear, thank you. Oh, you might be right, could be I was too focused on the length requirements, but might be worth trying without that check and adding for example two more zeros (18 digits), I don't think it will catch it
@josephhailey5155
@josephhailey5155 3 жыл бұрын
@@BogdanBudaca Turns out you were right! While I'm sure there are other methods to put it together without the conjunction, in this case it was needed to properly confirm Invalid cards that start with four, cards with a different length from the visa. Thanks for the reply!
@nullpointerexceptionn
@nullpointerexceptionn 4 жыл бұрын
Thank you so much for this video! I have a question. I'm trying to execute this problem in Visual Studio Code but that isn't working. Every time that I open the compiled file and put the CC number the problem returns the message "Please input CC number:". Notes: I have the "C/C++ for Visual Studio Code" extension and MinGW (With the path config) already installed I know the code is right because is the same code.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi Giovnn, glad you liked it. Not sure about the IDE setup to be honest, maybe also make sure that the CC number is a valid one
@nullpointerexceptionn
@nullpointerexceptionn 4 жыл бұрын
@@BogdanBudaca Thanks for answering me. I solved the problem. I replaced: long .... scanf ("% ld" .... for: long long int ... scanf ("% lld" ... I'm using Windows 10 x64, Visual Studio Code
@nabilalhoussein7877
@nabilalhoussein7877 4 жыл бұрын
Why did you change creditcardnumber to workingcc?? What is the point?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
To keep the one received via input separate and just make a copy of it to work on and change as needed; I can then restore it from the untouched original
@aliarifbolukbas1465
@aliarifbolukbas1465 4 жыл бұрын
thank you bro for the video but i have a problem. I wrote this program in dev c ++, but even though I wrote the correct card number, it requests the number again. What is the reason for this? Can you help me?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hey there, worth having a look at the validation checks on the input I guess, make sure those are right
@redsquirrel5800
@redsquirrel5800 3 жыл бұрын
This exercise belongs to CS50 Computer Science Course from Harvard, is`t it?
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Yup, that's right
@Girlwithherownwings
@Girlwithherownwings 2 жыл бұрын
Can you share the report pdf of this
@youtubejproasters1224
@youtubejproasters1224 Жыл бұрын
so i can follow up the logic behind your notes 100% , but when it goes to apply it to code , i start getting lost after the do while loop , i am full beginner , will it be okay to skip this problem till i reach better knowledge ? Or it will impact my studies further if i cant solve it and understand the mechanism after the do while loop in my mind ..
@BogdanBudaca
@BogdanBudaca Жыл бұрын
I would say my advice is to try some more, it's normal for things to take a while until they fall into place
@mfinancev7332
@mfinancev7332 4 жыл бұрын
bro i want visa offline 6 digit code how to generate . debit card and credit card for pos work
@azeg433
@azeg433 4 жыл бұрын
Hey, good video, do you have the source code? I'd like to study it better.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi AzeG, thank you; I'll put it up on Git and share it with you
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hey AzeG, you can now see the link to the code in the video description :)
@larajame1365
@larajame1365 3 жыл бұрын
Ok cool thanks fo the explanation but that's for checking if a real card is valid or no what about generating a card? Using any random bin let's say 531187 is it possible to generate a valid credit card number from it using luhn's algorithm or is it possible in any other way? I need for software testing your reply would be very helpful for me thanks!
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
I'd say it's more of a first check for input errors, but not sure about generating, there should be plenty samples online though.
@larajame1365
@larajame1365 3 жыл бұрын
Ik but those samples passed just the luhn algorithm test but when I tested them on the software they showed as invalid card number when I tried my card and some bunch of other cards that I have all shown as valid I need it to test the software probably and patch bug bins and fix more errors if I faced
@larajame1365
@larajame1365 3 жыл бұрын
Actually it's called credit card number extrapolation is it illegal to learn?? If you know anyone who can teach it will be appreciatful if it's not illegal obviously
@sohailriaz6634
@sohailriaz6634 2 жыл бұрын
@@larajame1365 hi can I have your any way to contact
@kainate5779
@kainate5779 4 жыл бұрын
Just question on % of equation: when it is 20 % 10 = 0 . Does mean i can USE same Logic AS if when i do 5 % 2 . Or is when the condition it should END 0 , does it mean for two digit that the Reminder is 0. While for one digit Is diffirent. Thanks.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
The modulo operation? Using % 10 gives us the last digit of the number; if the number is one digit, we will just get back the number. Hope this helps with your question en.wikipedia.org/wiki/Modulo_operation
@smarterthinks
@smarterthinks 2 жыл бұрын
bro do we get fake cc
@iHadiKsa
@iHadiKsa 3 жыл бұрын
why you put printf function twice time
@iHadiKsa
@iHadiKsa 3 жыл бұрын
i use ide.cs50 web but not working with me
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Oh maybe there's something missed, you can also check with the Github code
@md.shorifulislamfahim9406
@md.shorifulislamfahim9406 5 ай бұрын
who is here from CS50 ???
@yassinbagane
@yassinbagane 3 жыл бұрын
We can just make it easier by converting credit number to string
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Oh that's an interesting approach, did you get that working?
@DragonRazor9283
@DragonRazor9283 4 жыл бұрын
Well shit, mine was 200 lines of code xD
@ricardoneri4861
@ricardoneri4861 4 жыл бұрын
Subscribed thanks for the video! Great channel
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thanks Ricardo, glad you found it useful
How to compute readability (Coleman-Liau index) - C Programming
25:11
How to run a runoff election - C Programming
21:00
BogdanBudaca
Рет қаралды 9 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН
How to Validate a Credit Card Number in Java (Luhn Algorithem)
7:13
How to Decode Credit Card Numbers
5:20
Half as Interesting
Рет қаралды 6 МЛН
Validating Credit Cards with Luhn Check Algorithm
8:15
Adam Gaweda
Рет қаралды 87 М.
C Programming Tutorial for Beginners
3:46:13
freeCodeCamp.org
Рет қаралды 17 МЛН
Math for Liberal Studies: The Luhn Algorithm
4:11
James Hamblin
Рет қаралды 58 М.
Netflix Removed React?
20:36
Theo - t3․gg
Рет қаралды 62 М.
Pointers in C / C++ [Full Course]
3:47:23
freeCodeCamp.org
Рет қаралды 4,9 МЛН
How to encrypt messages (Substitution cipher) - C Programming
26:18
How to encrypt messages (Caesar cipher) - C Programming
15:09
BogdanBudaca
Рет қаралды 23 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН