Rock Paper Scissor game
import java.util.Scanner;
import java.util.Random;
public class rock {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Random ra = new Random();
int j = 1;
while (j == 1){
System.out.println("Rock->0 , Paper->1 , Scissor->2");
int ci = ra.nextInt( 3 );
System.out.print("Enter your no: ");
int my = sc.nextInt();
if (ci == my){
System.out.println("Draw");
}
else if (my == ci+1 || my == ci-2){
System.out.println("You win !!");
}
else {
System.out.println("You lose !!");
}
if (ci == 0){
System.out.println("Computer chose Rock");
}
else if (ci == 1){
System.out.println("Computer chose Paper");
}
else{
System.out.println("Computer chose Scissor");
}
System.out.println("Let's play again !!");
}
}
}