You have a green lottery ticket, with ints a, b, and c on it. If the numbers are all different from each other, the result is 0. If all of the numbers are the same, the result is 20. If two of the numbers are the same, the result is 10.
greenTicket(1, 2, 3) → 0
greenTicket(2, 2, 2) → 20
greenTicket(1, 1, 2) → 10
public class Main{
public static int greenTicket(int a, int b, int c)
{
if(a == b)
{
if(b == c)
return 20;
return 10;
}
if(a == c || b == c)
return 10;
return 0;
}
public static void main (String[] args) {
System.out.println(greenTicket(2,2,2));
}
}
Post the output
the code should be in java
run the code by your own on compiler java change greenTickect(2,2,2) with your questions input to get proper output
i have updated the whole code now run by your own