I've been working on my greedy with modulo for a while now and I'm not sure what I'm doing wrong.(For the moment I'm focusing on the part where I use integers to count the number of coins, skipping the part where I need to get the correct input in form of float etc.) But the compiler continues giving me the error "greedy.c:16:13: error: declaration shadows a local variable [-Werror,-Wshadow] int nc1 = s / 25;" What am I doing wrong? (I've included all libraries)
int main(void)
{
int s = get_int();
int nc1;
int nc2;
int nc3;
int nc4;
if ( s >= 25 )
{
int nc1 = s / 25;
int r = s % 25;
s = r;
}
if (s >= 10)
{
int nc2 = s / 10;
int r = s % 10;
s = r;
}
if (s >=5)
{
int nc3 = s / 5;
int r = s % 5;
s = r;
}
else (s >= 1)
{
int nc4 = s;
}
int nc = nc1 + nc2 + nc3 + s;
}