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"); }
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);
+ 1
You can watch videos about the math library there are more than pow
0
This xd
0
I didn't know about pow and still not. from where I can know about pow?