Give the output of:
int m[] = {13,11,134,62,12, 44};
int m[0] = {3};
m[1] = m[2];
int x = m[0] + m[1] + m[4];
System.out.println(x);
plz urgent give it by 23 april 10.pm plz I beg u
Answers
Answered by
5
Solution:
Correct cøde:
int m[] = {13,11,134,62,12, 44};
m[0] = 3;
m[1] = m[2];
int x = m[0] + m[1] + m[4];
System.out.println(x);
Output:
- 149
Explanation:
Initially,
→ m = {13, 11, 134, 62, 12, 44}
Now,
→ m[0] = 3
→ m = {3, 11, 134, 62, 12, 44}
Again,
→ m[1] = m[2]
So, array becomes,
→ m = {3, 134, 134, 62, 12, 44}
Now,
→ x = m[0] + m[1] + m[4]
→ x = 3 + 134 + 12
→ x = 149
★ So, the value of x is 149.
Learn More:
- Array: It is a collection of similar items.
- Example, - a[] = {1,2,3,4,5}
- Here, length of array = 5.
•••♪
Answered by
5
Output:-
149
Explaination:-
•Refer to attachment.
Initially, m[]= {13,11,134,62,12,44}
Now,
int m[0] = {3};
m[1] = m[2];
So,
index no. 0 element will store 3 and index number 1 element will store 134
•°• New array =>
Now,
x=m[0]+m[1]+m[4]
= 3+ 134+ 12
= 149
System.out.println(x); will print the value of x which is 149.
Attachments:
Similar questions