In: Computer Science
int count=0;
for (int i=2; i <= 4; i++ ) {
StdOut.println(i);
for (int j=1; j <3; j++) {
count++;
StdOut.println(i +" " + j +" "+ count);
}
}
count |
i |
j |
I print |
||
0 |
2 |
1 |
3 |
1 |
1 |
1 |
2 |
3 |
2 |
2 |
|
3 |
3 |
3 |
3 |
||
4 |
|||||
3 |
|||||
StdOut.println( “ call 1” + x );
public static double funk2( int a, double b, int c) {
int x = 15;
double result;
result = b - a*c;
if ( result <= x)
StdOut.println( " result " + b);
else
StdOut.println(" comp " + result);
return result;
}
Please find the answer for the above given questions..
a )
OUTPUT :
CODE :
class Main {
public static double funk2( int a, double b, int c) {
int x = 15;
double result;
result = b - a*c;
if ( result <= x)
System.out.println( "result " + b);
else
System.out.println("comp " + result);
return result;
}
public static void main(String[] args) {
double x = funk2( -2 , 5.0, 7);
System.out.println("call 1 : " + x );
}
}
b )
OUTPUT :
CODE :
class Main {
public static double funk2( int a, double b, int c) {
int x = 15;
double result;
result = b - a*c;
if ( result <= x)
System.out.println( "result " + b);
else
System.out.println("comp " + result);
return result;
}
public static void main(String[] args) {
double x = funk2( 1, 2.0, 4);
System.out.println("call 2 : " + x );
}
}
Thanks..