177Views3Replies

# Pi Problems

I am trying to write a program that calculates pi. I am doing it in Visual C++. I am using the Gregory-Leibniz series. My problem is that I cannot figure out how to do the division necessary. It isn't returning decimals. For example, 4/3 returns 1, and 1/2 is returning 0. Is it even possible to get it to return decimals? I've tried using int, float and short as the answer variable and none worked.

## Discussions

Thanks. That helped me a lot.