# i am working on problem set1 Cash. "else if" is not working

everything is working fine until the condition of remainder <= 5 is met (else if) then it just executes the first part only (if).

``````#include <stdio.h>
#include <math.h>
#include <cs50.h>
int main(void)

{

float n;
do
{
// prompt user for change
n = get_float("change owed: ");
}
while(n<0);
int cents = round(n * 100);
// perform division
// computes quotient
int quotient = cents / 25;

// computes remainder
int remainder = cents % 25;

printf("Quotient = %d\n", quotient);

printf("Remainder = %d\n", remainder);

if (remainder >= 10)
{
int quotient2 = remainder / 10;
int remainder2 = remainder % 10;
printf("Quotient2 = %d\n", quotient2);
printf("Remainder2 = %d\n", remainder2);
if (remainder2 >= 5)
{
int quotient4 = remainder2 / 5;
int remainder4 = remainder2 % 5;
printf("Quotient4 = %d\n", quotient4);
printf("Remainder4 = %d\n", remainder4);
int addition, subtraction, multiplication, division,               modulus;
addition = quotient + quotient4 + remainder4;
}
else if (remainder >=5)
{
int quotient3 = remainder / 5;
int remainder3 = remainder % 5;
printf("Quotient3 = %d\n", quotient3);
printf("Remainder3 = %d\n", remainder3);
}
else
{
printf("%d\n", remainder);
}
}

}
``````
• problem solved. thanks. one bracket was misplaced. Apr 3 '20 at 14:25

• One of the last two brackets is for the `if (remainder >= 10)`. Does that if statement have a proper close bracket?