+ 1
Fill in the blanks to create a method that returns the minimum of the two parameters. public int minFunc(int n1, int n2
Fill in the blanks to create a method that returns the minimum of the two parameters. public int minFunc(int n1, int n2 { int min; if (n1 > n2) min = ; min = n1; min; }
9 Réponses
+ 4
public int minFunc(int n1, int n2)
{
int min;
if (n1 > n2)
min = n2;
else
min = n1;
return min;
}
0
public int minFunc(int n1, int n2)
{
int min;
if (n1 > n2)
min = n2;
else
min = n1;
return min;
}
0
public int minFunc(int n1, int n2
)
{
int min;
if (n1 > n2)
min =
n2
;
else
min = n1;
return
min;
}
0
import java.util.Scanner;
//your code goes here
public class Program {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
System.out.print(Converter.toBinary(x));
}
}
public class Converter {
public static String toBinary (int x){
String binary="";
while (x>0){
binary= (x%2)+binary;
x = x/2;
}
return binary;
}
}
0
Fill in the blank to define a method that does not return a value.
public calc()
- 2
public int minFunc(int n1,int n2 ;){
int min;
if(n1>n2) min=n2;
else min=n1;
return min;
}
- 3
public int minFunc(int n1,int n2){
int min;
if(n1>n2) min=n2;
else min=n1;
return min;
}
- 3
public int minFunc(int n1, int n2)
{
int min;
if (n1 > n2)
min =n2;
else
min = n1;
return min;
}