Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (1.5k points)

While executing this piece of code, i am getting output as 0.

public static void main(String[] args) {
    double g = 1 / 3;
    System.out.printf("%.2f", g);

How can I solve this? 

Please log in to answer this question.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...