i'm beginner in c++ or any type of programming. i use code::blocks and turboc++
for compiling. But both of them are giving me trouble in calculating floating point variables.I coded following program
using namespace std;
which should have returned 1.5 as output but it only returns 1.
i dont know what problem it is but help.
i used double data type as well, but that also did't work.
Since both 'a' and 'b' are integers, the operation of a/b creates an integer before storing the final value into 'c'. Try declaring 'a' and 'b' as floats too.