ExamVeda
Login
Home
This question belongs to Java Program Flow Control
Flow Control
?

Choose the correct statement in context of the following program code.
public class Test{
      public static void main(String[] args){
            double sum = 0;
            for(double d = 0; d < 10;){
                  d += 0.1;
                  sum += sum + d;
            }
      }
}

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Vimlesh Yadav
Vimlesh Yadav 7 years ago
it compiles and runs successfully but it will stop when d value in (d+=0.1) statement becomes 10