1. ## Math Division Problem

I will put the code in first! I will not pu the whole code as it takes too much space! I will just put the thing that I need help on!
Code:
```else if (choice == 4)
{
printf ("You chose division!\n\n");
printf ("Input the first integer,x:\n");
scanf ("%d", &x);
printf ("Input the second integer, y:\n");
scanf ("%d", &y);
printf ("The result is:%d\n", x / y);
}```
If I do not put in soem decimals like 10 and 5 or 30 and 10 or something that divides proper, I would give me some crazy results! I tried floating point with %f instead of %d and defined x and y as float also and it gives me -o.something different all the time!

What is the mistake or what do I need to do to make it work properly?

BTW, I tried the % operator instead of / division too, then it gives me plain 0!

What is the mistake or what do I need to do to make it work properly?
If you expect a floating point result, use floating point rather than integers. Integer math is not the same as floating point math.

3. Could you show your "crazy results"?
like 5/2 == 2
or 17 / 3 = 5
?

And also your code using floats could be of some interest. Post it too.

4. Integer division - 9/5 doesn't mean 1.8 or 2, it means 1. Even to a float, double, or 1 million-bit floating point variable, it doesn't mean exactly 1.8. That's the thing with division.

5. ## Making myself clear

All I want from it is to show me the remainder also!

I tried the % operator but still doesn't work!

6. If you would post a sample input and corresponding output of what you call "crazy", we might be able to better assist you in understanding what is going on.

7. Just make x and y doubles instead of ints (and make the appropriate changes to the scanf and printf format specifiers) and things should be fine. Doing division on integers chops off any "remainder".

8. printf ("&#37;d divided by %d is %d reminder %d", 10,3,10/3,10%3);