I divided 13/24 in java but the result value is printed as 0.0;

the variables like;

int asd = 13;
int dfg = 24;
double result = (double)(asd / dfg);

print(result); // 0.00

How can I get the exact value?

by type casting each value berofe evaluation. :)

Please try this code. It is working fine and will give you the desired result.

public class AddSample{
	public static void main(String args[]){

		int asd = 13;
		int dfg = 24;
		double result = 0.0;
		result = (double)asd/dfg;
		System.out.println(result);
	}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.