I am trying to get the main to read in a number, and use that number to do a mod calculation. However my best efforts are giving me garbage values. I am sure I am not using the pointer correctly, yet my efforts have gone unrewarded. How can I get this program to take in a number and see if it divisible by 5?
#include <stdio.h>
#define POPPRICE 50 /*what the pop price is in cents*/
char c;
int leftover=POPPRICE; //
int value; // what was entered
int main(int argc, char *argv[])
{
value=(int)argv[1];
if ((value / 5) != 10)
{
printf("Please enter a number of multiples of 5\n");
printf("%d\n",value);
}
else
{
printf("The price of pop is %d, cents", POPPRICE);
printf("Please insert any combination of nickels [N or n],\n");
printf("dimes [D or d] or quarters [Q or q].\n");
printf("You can also return your money to you by pressing R or r\n");
while ((c=getchar())!='e' && (c=getchar())!='E')
{
printf("We have not yet exited\n");
scanf("%d",&value);
}
}
}