+ 2
Hello I dont understand this code, why output is 3? That's wrong. ( 10/3=3.3333333333)
#include <iostream> using namespace std; int main() { int x = 10 / 3; cout << x; return 0; }
11 Respostas
+ 1
answer is variable type you determined.
the best solution to such a problems. using "auto" type variable and typing exactly float style
+ 11
#include <iostream>
using namespace std;
int main() {
float x = 10;
cout << x/3;
return 0;
}
+ 9
it is not wrong.
x is integer than the result must be integer
+ 8
because x is an int, not a float (decimal)
+ 6
10/3 is 3.33333 but your combiner doesn't show the decimal.
+ 3
try making x a float instead
+ 1
I tried but it's same answer.
#include <iostream>
using namespace std;
int main ()
{
float x = 10 / 3;
cout << x;
return 0;
// output is "3"
// đš
}
+ 1
I've got it: use 10.0 and 3.0 instead of 10 and 3. Any Luck?
0
đđđđđ
0
Did 10.0 and 3.0 work for you?
0
try this one
#include <iostream>
using namespace std;
int main(){
float x,y;
cout << x/y;
return 0;
}