im doing the cs50 course and doing this problem https://cs50.harvard.edu/x/2022/psets/1/credit/
while(cardnumber!=0)
{
digits[noofdigits]=cardnumber%10;
printf("count: %i \n", digits[noofdigits]);
cardnumber=cardnumber/10;
noofdigits++;
}
this is the output thats coming out
Number:12345
count: 5
count: 4
count: 3
count: 3
count: 4
cardnumber%10- should get the last digit onto the array right what's happening here i don't understand
while(cardnumber!=0)
{
digits[noofdigits]=cardnumber%10;
printf("count: %i \n", digits[noofdigits]);
cardnumber=cardnumber/10;
noofdigits++;
}
this is the output thats coming out
Number:12345
count: 5
count: 4
count: 3
count: 3
count: 4
cardnumber%10- should get the last digit onto the array right what's happening here i don't understand