Menu
Question Index
...

What will be the output of the following program?

class NestedFor
{
    public static void main(String s[])
    {
        int sum = 23;        

        for(int i = 2; i <= 5; i++ )
        {
            for(int j = 7; j <= 9; j++ )
            {
                sum += ( i * j);
            }
        }

        System.out.println("sum = " + sum);
    }
}


sum = 336
sum = 359
Compilation errors
sum = 45

Doubts

Problems

Topic: Nested for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App