cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
1/3=0?
1/3=0?
Jul 24, 2011 at 7:52am UTC
sf123
(45)
I noticed that when I divide a small number by a large number such as 1/3 it is equal to 0. Is there any alternative for me to divide small number by a larger number?
Thanks!
Jul 24, 2011 at 8:08am UTC
hamsterman
(4538)
When you divide two integers, you get an integer.
Try 1.0/3
Jul 24, 2011 at 8:18am UTC
sf123
(45)
ok thanks hamsterman, is it fine to just have 1.0/3.0 instead of the one that you suggested?
Jul 24, 2011 at 9:35am UTC
LBEaston
(91)
Yeah that will be fine also.
Topic archived. No new replies allowed.