0

what type of variable I should use for this code?

I can't use string here because there are number also. so what kinna variable to use here for "sum" to make this code work? if(sum==(a+b)^2){ System.out.println("(a-b)^2+4ab"); }

22nd Apr 2018, 6:33 AM
RH Tasin
RH Tasin - avatar
6 Respuestas
+ 1
I don't know much of java but i think that your code should look like this if(sum==(a+b)^2) { System.out.println((a-b)^2+4*a*b) ; } If this doesn't work you ahould use another method for the square. It may called "pow". It takes two parameters the first one is the (a+b) and the second one is the 2.so it should look like this pow((a+b), 2);
22nd Apr 2018, 6:56 AM
xaralampis_
xaralampis_ - avatar
+ 1
You can watch videos about the math library there are more than pow
23rd Apr 2018, 10:48 AM
xaralampis_
xaralampis_ - avatar
0
This xd
22nd Apr 2018, 7:20 AM
xaralampis_
xaralampis_ - avatar
0
I didn't know about pow and still not. from where I can know about pow?
23rd Apr 2018, 5:42 AM
RH Tasin
RH Tasin - avatar