C: Unable to use modulus operators to break down change into denominations, storing into an array and print...












-2














I'm attempting to write a program in which:




  • The user inputs the cost of an item

  • The user inputs the amount they paid for the item

  • The program determines if the user is owed any change

  • The program calculates the amount of change owed

  • The program uses the modulus operator to break the amount of change down into coin denominations

  • The program stores the change and coin denominations into an array This is the first bit at which I'm getting stuck

  • The program displays the amount of change in coin denominations to the user


The purpose is to use an array to hold the values of the coins, so I "can write a general purpose change calculator that can be used for any coinage by changing the contents of the array".



Here is my code:



void vendingMachine()
{

// Declarations
#define ARRAY_LENGTH 6

int itemCost;
int amountEntered;
int fifty, twenty, ten, five, two, one;
int remainder;

// User input

printf("Please enter the cost of the item in pence: ");
scanf_s("%d", &itemCost);
while (itemCost <= 0 || itemCost > 99)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 99p: ");
scanf_s("%d", &itemCost);
}

printf("Please enter the amount entered into the machine in pence: ");
scanf_s("%d", &amountEntered);
while (amountEntered <= 0 || amountEntered > 100)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 100p: ");
scanf_s("%d", &amountEntered);
}

while (amountEntered < itemCost)
{
printf("You've entered an invalid amount. Please enter an amount equal to or higher than the cost of the item: ");
scanf_s("%d", &amountEntered);
}

// Program to determine if the customer is owed any change and, if so, how much is owed

if (amountEntered == itemCost)
{
printf("No change is owed to the customer");
}
else if (amountEntered > itemCost)
{
int change = amountEntered - itemCost;
printf("The amount of change owed to the customer is: %d pence, broken down as follows: n", change);

fifty = change / 50;
remainder = change % 50;
twenty = remainder / 20;
remainder = remainder % 20;
ten = remainder / 10;
remainder = remainder % 10;
five = remainder / 5;
remainder = remainder % 5;
two = remainder / 2;
remainder = remainder % 2;
one = remainder;

// Program to store the change in an array

int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;

for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}

for (int i = 0; i < ARRAY_LENGTH; i++)
{
printf("The number of %d coins is: %dn", //I don't know what to do here);
}
}
}









share|improve this question
























  • What's the point of count[i] = 0 which deletes all the assignments you did before?
    – Henning Koehler
    Nov 12 at 11:17










  • In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
    – hailnolly
    Nov 12 at 11:26










  • "This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
    – chux
    Nov 12 at 15:13


















-2














I'm attempting to write a program in which:




  • The user inputs the cost of an item

  • The user inputs the amount they paid for the item

  • The program determines if the user is owed any change

  • The program calculates the amount of change owed

  • The program uses the modulus operator to break the amount of change down into coin denominations

  • The program stores the change and coin denominations into an array This is the first bit at which I'm getting stuck

  • The program displays the amount of change in coin denominations to the user


The purpose is to use an array to hold the values of the coins, so I "can write a general purpose change calculator that can be used for any coinage by changing the contents of the array".



Here is my code:



void vendingMachine()
{

// Declarations
#define ARRAY_LENGTH 6

int itemCost;
int amountEntered;
int fifty, twenty, ten, five, two, one;
int remainder;

// User input

printf("Please enter the cost of the item in pence: ");
scanf_s("%d", &itemCost);
while (itemCost <= 0 || itemCost > 99)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 99p: ");
scanf_s("%d", &itemCost);
}

printf("Please enter the amount entered into the machine in pence: ");
scanf_s("%d", &amountEntered);
while (amountEntered <= 0 || amountEntered > 100)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 100p: ");
scanf_s("%d", &amountEntered);
}

while (amountEntered < itemCost)
{
printf("You've entered an invalid amount. Please enter an amount equal to or higher than the cost of the item: ");
scanf_s("%d", &amountEntered);
}

// Program to determine if the customer is owed any change and, if so, how much is owed

if (amountEntered == itemCost)
{
printf("No change is owed to the customer");
}
else if (amountEntered > itemCost)
{
int change = amountEntered - itemCost;
printf("The amount of change owed to the customer is: %d pence, broken down as follows: n", change);

fifty = change / 50;
remainder = change % 50;
twenty = remainder / 20;
remainder = remainder % 20;
ten = remainder / 10;
remainder = remainder % 10;
five = remainder / 5;
remainder = remainder % 5;
two = remainder / 2;
remainder = remainder % 2;
one = remainder;

// Program to store the change in an array

int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;

for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}

for (int i = 0; i < ARRAY_LENGTH; i++)
{
printf("The number of %d coins is: %dn", //I don't know what to do here);
}
}
}









share|improve this question
























  • What's the point of count[i] = 0 which deletes all the assignments you did before?
    – Henning Koehler
    Nov 12 at 11:17










  • In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
    – hailnolly
    Nov 12 at 11:26










  • "This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
    – chux
    Nov 12 at 15:13
















-2












-2








-2


1





I'm attempting to write a program in which:




  • The user inputs the cost of an item

  • The user inputs the amount they paid for the item

  • The program determines if the user is owed any change

  • The program calculates the amount of change owed

  • The program uses the modulus operator to break the amount of change down into coin denominations

  • The program stores the change and coin denominations into an array This is the first bit at which I'm getting stuck

  • The program displays the amount of change in coin denominations to the user


The purpose is to use an array to hold the values of the coins, so I "can write a general purpose change calculator that can be used for any coinage by changing the contents of the array".



Here is my code:



void vendingMachine()
{

// Declarations
#define ARRAY_LENGTH 6

int itemCost;
int amountEntered;
int fifty, twenty, ten, five, two, one;
int remainder;

// User input

printf("Please enter the cost of the item in pence: ");
scanf_s("%d", &itemCost);
while (itemCost <= 0 || itemCost > 99)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 99p: ");
scanf_s("%d", &itemCost);
}

printf("Please enter the amount entered into the machine in pence: ");
scanf_s("%d", &amountEntered);
while (amountEntered <= 0 || amountEntered > 100)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 100p: ");
scanf_s("%d", &amountEntered);
}

while (amountEntered < itemCost)
{
printf("You've entered an invalid amount. Please enter an amount equal to or higher than the cost of the item: ");
scanf_s("%d", &amountEntered);
}

// Program to determine if the customer is owed any change and, if so, how much is owed

if (amountEntered == itemCost)
{
printf("No change is owed to the customer");
}
else if (amountEntered > itemCost)
{
int change = amountEntered - itemCost;
printf("The amount of change owed to the customer is: %d pence, broken down as follows: n", change);

fifty = change / 50;
remainder = change % 50;
twenty = remainder / 20;
remainder = remainder % 20;
ten = remainder / 10;
remainder = remainder % 10;
five = remainder / 5;
remainder = remainder % 5;
two = remainder / 2;
remainder = remainder % 2;
one = remainder;

// Program to store the change in an array

int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;

for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}

for (int i = 0; i < ARRAY_LENGTH; i++)
{
printf("The number of %d coins is: %dn", //I don't know what to do here);
}
}
}









share|improve this question















I'm attempting to write a program in which:




  • The user inputs the cost of an item

  • The user inputs the amount they paid for the item

  • The program determines if the user is owed any change

  • The program calculates the amount of change owed

  • The program uses the modulus operator to break the amount of change down into coin denominations

  • The program stores the change and coin denominations into an array This is the first bit at which I'm getting stuck

  • The program displays the amount of change in coin denominations to the user


The purpose is to use an array to hold the values of the coins, so I "can write a general purpose change calculator that can be used for any coinage by changing the contents of the array".



Here is my code:



void vendingMachine()
{

// Declarations
#define ARRAY_LENGTH 6

int itemCost;
int amountEntered;
int fifty, twenty, ten, five, two, one;
int remainder;

// User input

printf("Please enter the cost of the item in pence: ");
scanf_s("%d", &itemCost);
while (itemCost <= 0 || itemCost > 99)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 99p: ");
scanf_s("%d", &itemCost);
}

printf("Please enter the amount entered into the machine in pence: ");
scanf_s("%d", &amountEntered);
while (amountEntered <= 0 || amountEntered > 100)
{
printf("You've entered an invalid amount. Please enter an amount between 1p and 100p: ");
scanf_s("%d", &amountEntered);
}

while (amountEntered < itemCost)
{
printf("You've entered an invalid amount. Please enter an amount equal to or higher than the cost of the item: ");
scanf_s("%d", &amountEntered);
}

// Program to determine if the customer is owed any change and, if so, how much is owed

if (amountEntered == itemCost)
{
printf("No change is owed to the customer");
}
else if (amountEntered > itemCost)
{
int change = amountEntered - itemCost;
printf("The amount of change owed to the customer is: %d pence, broken down as follows: n", change);

fifty = change / 50;
remainder = change % 50;
twenty = remainder / 20;
remainder = remainder % 20;
ten = remainder / 10;
remainder = remainder % 10;
five = remainder / 5;
remainder = remainder % 5;
two = remainder / 2;
remainder = remainder % 2;
one = remainder;

// Program to store the change in an array

int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;

for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}

for (int i = 0; i < ARRAY_LENGTH; i++)
{
printf("The number of %d coins is: %dn", //I don't know what to do here);
}
}
}






c arrays modulus integer-division






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 11:07

























asked Nov 12 at 10:42









hailnolly

186




186












  • What's the point of count[i] = 0 which deletes all the assignments you did before?
    – Henning Koehler
    Nov 12 at 11:17










  • In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
    – hailnolly
    Nov 12 at 11:26










  • "This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
    – chux
    Nov 12 at 15:13




















  • What's the point of count[i] = 0 which deletes all the assignments you did before?
    – Henning Koehler
    Nov 12 at 11:17










  • In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
    – hailnolly
    Nov 12 at 11:26










  • "This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
    – chux
    Nov 12 at 15:13


















What's the point of count[i] = 0 which deletes all the assignments you did before?
– Henning Koehler
Nov 12 at 11:17




What's the point of count[i] = 0 which deletes all the assignments you did before?
– Henning Koehler
Nov 12 at 11:17












In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
– hailnolly
Nov 12 at 11:26




In entire honesty, I got stuck here and was using code from the notes I was given. I don't think there is a point - thank you for pointing out what that code does.
– hailnolly
Nov 12 at 11:26












"This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
– chux
Nov 12 at 15:13






"This is the first bit at which I'm getting stuck" --> How/why are you stuck? What is unclear about the functionality at for (int i = 0; i < ARRAY_LENGTH; i++) { count[i] = 0; }?
– chux
Nov 12 at 15:13














2 Answers
2






active

oldest

votes


















0














Store the type of coins in an array as well, e.g.



const int coins[ARRAY_LENGTH] = { 50, 20, 10, 5, 2, 1 };


Then you can easily refer to them in your loop:



printf("The number of %d coins is: %dn", coins[i], count[i]);


This also allows you to perform your modulo calculations in a loop.






share|improve this answer





















  • Thank you very much Henning. That's solved my problem!
    – hailnolly
    Nov 12 at 16:45



















0














I am not sure what you are trying to achieve here:



The following piece of (your) code sets the values of count from index 0 to index 5, starting from fifty to one..



int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;


Then here, you are overwriting those with 0 in the for loop.



for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}


So above loop is not required, or at least must not be placed after you have assigned values of fifty, twenty, ten, five, two and one to count array indices.



I guess you are trying to print them? You don't have to use a loop here:



// Doing it the newbie-way:

printf("The number of coins of 50 are: %dn", count[0]);
printf("The number of coins of 20 are: %dn", count[1]);
printf("The number of coins of 10 are: %dn", count[2]);
printf("The number of coins of 5 are: %dn", count[3]);
printf("The number of coins of 2 are: %dn", count[4]);
printf("The number of coins of 1 are: %dn", count[5]);





share|improve this answer





















  • Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
    – hailnolly
    Nov 12 at 16:46












  • @hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
    – WedaPashi
    Nov 13 at 4:45











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260464%2fc-unable-to-use-modulus-operators-to-break-down-change-into-denominations-stor%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Store the type of coins in an array as well, e.g.



const int coins[ARRAY_LENGTH] = { 50, 20, 10, 5, 2, 1 };


Then you can easily refer to them in your loop:



printf("The number of %d coins is: %dn", coins[i], count[i]);


This also allows you to perform your modulo calculations in a loop.






share|improve this answer





















  • Thank you very much Henning. That's solved my problem!
    – hailnolly
    Nov 12 at 16:45
















0














Store the type of coins in an array as well, e.g.



const int coins[ARRAY_LENGTH] = { 50, 20, 10, 5, 2, 1 };


Then you can easily refer to them in your loop:



printf("The number of %d coins is: %dn", coins[i], count[i]);


This also allows you to perform your modulo calculations in a loop.






share|improve this answer





















  • Thank you very much Henning. That's solved my problem!
    – hailnolly
    Nov 12 at 16:45














0












0








0






Store the type of coins in an array as well, e.g.



const int coins[ARRAY_LENGTH] = { 50, 20, 10, 5, 2, 1 };


Then you can easily refer to them in your loop:



printf("The number of %d coins is: %dn", coins[i], count[i]);


This also allows you to perform your modulo calculations in a loop.






share|improve this answer












Store the type of coins in an array as well, e.g.



const int coins[ARRAY_LENGTH] = { 50, 20, 10, 5, 2, 1 };


Then you can easily refer to them in your loop:



printf("The number of %d coins is: %dn", coins[i], count[i]);


This also allows you to perform your modulo calculations in a loop.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 11:20









Henning Koehler

1,129610




1,129610












  • Thank you very much Henning. That's solved my problem!
    – hailnolly
    Nov 12 at 16:45


















  • Thank you very much Henning. That's solved my problem!
    – hailnolly
    Nov 12 at 16:45
















Thank you very much Henning. That's solved my problem!
– hailnolly
Nov 12 at 16:45




Thank you very much Henning. That's solved my problem!
– hailnolly
Nov 12 at 16:45













0














I am not sure what you are trying to achieve here:



The following piece of (your) code sets the values of count from index 0 to index 5, starting from fifty to one..



int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;


Then here, you are overwriting those with 0 in the for loop.



for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}


So above loop is not required, or at least must not be placed after you have assigned values of fifty, twenty, ten, five, two and one to count array indices.



I guess you are trying to print them? You don't have to use a loop here:



// Doing it the newbie-way:

printf("The number of coins of 50 are: %dn", count[0]);
printf("The number of coins of 20 are: %dn", count[1]);
printf("The number of coins of 10 are: %dn", count[2]);
printf("The number of coins of 5 are: %dn", count[3]);
printf("The number of coins of 2 are: %dn", count[4]);
printf("The number of coins of 1 are: %dn", count[5]);





share|improve this answer





















  • Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
    – hailnolly
    Nov 12 at 16:46












  • @hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
    – WedaPashi
    Nov 13 at 4:45
















0














I am not sure what you are trying to achieve here:



The following piece of (your) code sets the values of count from index 0 to index 5, starting from fifty to one..



int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;


Then here, you are overwriting those with 0 in the for loop.



for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}


So above loop is not required, or at least must not be placed after you have assigned values of fifty, twenty, ten, five, two and one to count array indices.



I guess you are trying to print them? You don't have to use a loop here:



// Doing it the newbie-way:

printf("The number of coins of 50 are: %dn", count[0]);
printf("The number of coins of 20 are: %dn", count[1]);
printf("The number of coins of 10 are: %dn", count[2]);
printf("The number of coins of 5 are: %dn", count[3]);
printf("The number of coins of 2 are: %dn", count[4]);
printf("The number of coins of 1 are: %dn", count[5]);





share|improve this answer





















  • Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
    – hailnolly
    Nov 12 at 16:46












  • @hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
    – WedaPashi
    Nov 13 at 4:45














0












0








0






I am not sure what you are trying to achieve here:



The following piece of (your) code sets the values of count from index 0 to index 5, starting from fifty to one..



int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;


Then here, you are overwriting those with 0 in the for loop.



for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}


So above loop is not required, or at least must not be placed after you have assigned values of fifty, twenty, ten, five, two and one to count array indices.



I guess you are trying to print them? You don't have to use a loop here:



// Doing it the newbie-way:

printf("The number of coins of 50 are: %dn", count[0]);
printf("The number of coins of 20 are: %dn", count[1]);
printf("The number of coins of 10 are: %dn", count[2]);
printf("The number of coins of 5 are: %dn", count[3]);
printf("The number of coins of 2 are: %dn", count[4]);
printf("The number of coins of 1 are: %dn", count[5]);





share|improve this answer












I am not sure what you are trying to achieve here:



The following piece of (your) code sets the values of count from index 0 to index 5, starting from fifty to one..



int count[ARRAY_LENGTH];
count[0] = fifty;
count[1] = twenty;
count[2] = ten;
count[3] = five;
count[4] = two;
count[5] = one;


Then here, you are overwriting those with 0 in the for loop.



for (int i = 0; i < ARRAY_LENGTH; i++)
{
count[i] = 0;
}


So above loop is not required, or at least must not be placed after you have assigned values of fifty, twenty, ten, five, two and one to count array indices.



I guess you are trying to print them? You don't have to use a loop here:



// Doing it the newbie-way:

printf("The number of coins of 50 are: %dn", count[0]);
printf("The number of coins of 20 are: %dn", count[1]);
printf("The number of coins of 10 are: %dn", count[2]);
printf("The number of coins of 5 are: %dn", count[3]);
printf("The number of coins of 2 are: %dn", count[4]);
printf("The number of coins of 1 are: %dn", count[5]);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 11:55









WedaPashi

2,3691333




2,3691333












  • Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
    – hailnolly
    Nov 12 at 16:46












  • @hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
    – WedaPashi
    Nov 13 at 4:45


















  • Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
    – hailnolly
    Nov 12 at 16:46












  • @hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
    – WedaPashi
    Nov 13 at 4:45
















Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
– hailnolly
Nov 12 at 16:46






Thanks! I really didn't realise (I'm new to this language, and programming in general) I was cancelling out my array, which is really embarrassing. Thank you for taking the time to help me.
– hailnolly
Nov 12 at 16:46














@hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
– WedaPashi
Nov 13 at 4:45




@hailnolly: No, its not embarrassing at all. We all have been learning from out mistakes in programming :-)
– WedaPashi
Nov 13 at 4:45


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260464%2fc-unable-to-use-modulus-operators-to-break-down-change-into-denominations-stor%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues