0
question about JAVA(how to increment a result?)
for example int a = 1165; System.out.println(Math.sqrt(a)); the answer is 34 from console,then i wanna increment this reasult or work on this result directly, without bringing another variable and giving a value of the result like this [ int b=34; System.out.println(++b); ]
2 ответов
+ 2
You can assign the result back to the same variable.
int a = 1165;
a = (int)Math.sqrt(a);
System.out.print(++a);
0
Thanks ! it works