0
how this code prints 0
#include <iostream> using namespace std; int main() { float area; float a=5; float b=10; area=(1/2)*a*b; cout <<area; }
3 Respostas
+ 6
Maybe write 0.5 than 1/2?
+ 4
1/2 are integers, so the result is 0.
So you wrote: 0*a*b.
Change the beginning to (1.0/2)!
+ 2
Or that.