Home » JAVA Programming » Variable Types » Question
  1. What is the output of this program?

    public class output
    {
    public static void main(String args[])
    {
    int p[] = {5,6,7,8,9};
    int q[] = p;
    int sum = 0;
    for (int j = 0; j < 4; ++j)
    sum += (p[j] * q[j + 1]) + (p[j + 1] * q[j]);
    System.out.println(sum);
    }
    }
    1. 400
    2. 300
    3. 200
    4. 100
    5. None of these
Correct Option: A

400



Your comments will be displayed only after manual approval.