B
Bharat Bhushan
Hi,
How can I store upto 10 decimal places in a variable. I have tried this code
with float and double datatype but it only prints 1.0
public class tmp
{
static void main(String[] args)
{
float a1 = 0.0000000000f;
a1 = 2/3;
System.out.print(a1);
}
}
It only prints 0.0 whereas I would like it to print 0.6666666666
Thanks for your time.
- Bharat.
How can I store upto 10 decimal places in a variable. I have tried this code
with float and double datatype but it only prints 1.0
public class tmp
{
static void main(String[] args)
{
float a1 = 0.0000000000f;
a1 = 2/3;
System.out.print(a1);
}
}
It only prints 0.0 whereas I would like it to print 0.6666666666
Thanks for your time.
- Bharat.