int f(int x) {
return x*2 - 1;
}
int h() {
int a = 3;
int b = f(a) + f(4);
return b;
}
what is the output of this coding?
Answers
Answered by
0
Answer:
CODING
Explanation:
The given coding is:
int f(int x) {
return x*2 - 1;
}
int h() {
int a = 3;
int b = f(a) + f(4);
return b;
}
According to the coding, we have
- and
We have to find the output of the given coding.
That means, we have to find the value of .
We have, .
Therefore, we get
So, the output of the coding will be .
Answered by
0
Error: Runtime error.
The function int f(int x) is defined before the int h() function.
But here, for the output there should be main class that is public static void main(String args[]) class.
In that class both of this function should be called by making use of the object of the class.
Explanation:
int f(int x) {
return x*2 - 1;
}
int h() {
int a = 3;
int b = f(a) + f(4);
return b;
}
the public class should be added firstly.
After that both of this function will get called in public static void main (String args[]) class
Then declare the object of the class for eg, abc is the class a is the object of the class .
Then call the function by a.int f(10);
and a.h();
Similar questions