πŸ“Š JAVA
Q. What will be the output of the following Java program?
class evaluate
{
public static void main(String args[])
{
int a[] = {1,2,3,4,5};
int d[] = a;
int sum = 0;
for (int j = 0; j < 3; ++j)
sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
System.out.println(sum);
}
}
  • (A) 38
  • (B) 39
  • (C) 40
  • (D) 41
πŸ’¬ Discuss
βœ… Correct Answer: (C) 40

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
72
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Ritu Nagar
Publisher
πŸ“ˆ
89%
Success Rate