When I run this program, I am not getting this answer:

"You will eat 76 meals at Subway and 74 meals at Lazy Moon."

"You will have $1 left on your card."

Heres the Question:

You will prompt the user for the following information:

1. The cost of a meal at Subway (in dollars – must be an integer).

2. The cost of a meal at Lazy Moon (in dollars – must be an integer and greater than #1).

3. The number of meals you will need to eat for the semester.

4. The amount of money (in dollars – must be an integer) your parents have put on your meal card.

Input Specification

1. The cost of both meals will be positive integers less than 20 with the cost of a meal at Lazy Moon being more expensive than the cost of a meal at Subway.

2. The number of meals will be a positive integer less than 300.

3. The amount of money your parents place on your meal card will be a positive integer that is somewhere in between the cost of eating every meal at Subway and the cost of eating every meal at Lazy Moon, inclusive.

Sample Run

How much do you spend on a meal at Subway?

4

How much do you spend on a meal at Lazy Moon?

6

How many meals will you eat this semester?

150

How much money did your parents put on your meal card?

749

You will eat 76 meals at Subway and 74 meals at Lazy Moon.

You will have $1 left on your card.

I did my math like this:Code:`#include <stdio.h>`

int main(void)

{

int number_of_meals_eaten_at_subway, number_of_meals_eaten_at_Lazy_Moon, spent_at_subway, spent_at_Lazy_Moon,

eat_this_semester, limit_on_meal_card;

char x, y, a, b, c, d;

x = number_of_meals_eaten_at_subway;

y = number_of_meals_eaten_at_Lazy_Moon;

a = spent_at_subway;

b = spent_at_Lazy_Moon;

c = eat_this_semester;

d = limit_on_meal_card;

printf ("How much do you spend on a meal at subway? \n");

scanf ("%d", &spent_at_subway, a);

printf ("How much do you spend on a meal at Lazy Moon? \n");

scanf ("%d", &spent_at_Lazy_Moon, b);

printf ("How many meals will you eat this semester? \n");

scanf ("%d", &eat_this_semester, c);

printf ("How much money did your parents put on your meal card? \n");

scanf ("%d", &limit_on_meal_card, d);

y = (c - a*d)/(-a + b);

x = (b*d + c - 2*a*d)/(-a + b);

printf ("You will eat %d meals at subway" "and %d meals at Lazy Moon\n", number_of_meals_eaten_at_subway,

number_of_meals_eaten_at_Lazy_Moon);

printf ("You will have %d left on your card", limit_on_meal_card);

getch ();

return 0;

}

Ax + By = C

X + Y = D

(I put what a, b, c, and d are in the program).

When I solve for X and Y, I get the equation that I placed in the program.

X + Y = D

X = D - Y

X = D - (C - AD) / (-A + B) (tried leaving like this, but did not come out to right answer)

X = (BD + C - 2AD) / (-A + B) (Did it like I was adding fraction. Still not right answer)

AX + BY = C

A(D - Y) + BY = C

AD - AY + BY = C

-AY + BY = C - AD

Y = (C - AD) / (-A + B)

Can anyone tell me what I missing or doing wrong?

Thanks,

BLG