cant calculate floating point values

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;

int main()
int a=15,b=10;
float c;
return 0;

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.
Topic archived. No new replies allowed.