Find the output of the following:
int a[]={5,7,9,3,1};
for(int i=0;i<=4;i++)
System.out.println(Math.pow(a[i],2)-1);
Answers
Answered by
1
Output:
24.0
48.0
80.0
8.0
0.0
Answered by
2
Question:-
Find the output of the following code.
Solution:-
Given code,
int a[]={5,7,9,3,1}
for(int i=0;i<=4;i++)
System.out.println(Math.pow(a[i],2)-1);
When i=0
a[i]=5
5^2 - 1=24.0
When i=1
a[i]=7
7^2 - 1=48.0
When i=2
a[i]=9
9^2-1=80.0
When i=3
a[i]=3
3^2 - 1=8.0
When i=4
a[i]=1
1^1 - 1=0.0
Output:-
Hence, the required output is,
24.0
48.0
80.0
8.0
0.0
Similar questions