From e345b1400be66bbce1d57e02b409a9dfaa96b5ae Mon Sep 17 00:00:00 2001 From: anikhandelwal <69295786+anikhandelwal@users.noreply.github.com> Date: Wed, 26 May 2021 18:28:17 +0530 Subject: [PATCH] Anirudh_Khandelwal added --- Anirudh_Khandelwal_Rock_paper_scissor.md | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Anirudh_Khandelwal_Rock_paper_scissor.md diff --git a/Anirudh_Khandelwal_Rock_paper_scissor.md b/Anirudh_Khandelwal_Rock_paper_scissor.md new file mode 100644 index 0000000..cc0a2eb --- /dev/null +++ b/Anirudh_Khandelwal_Rock_paper_scissor.md @@ -0,0 +1,32 @@ + +//Anirudh Khandelwal + +package com.company; + +import java.util.Random; +import java.util.Scanner; + +public class RockPaperScissor { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("Enter 0:ROCK 1:PAPER 2:SCISSOR"); + int userinput = sc.nextInt(); + + + Random random = new Random(); + int computerinput = random.nextInt(2); + System.out.print("Computer Entered "); + System.out.println(computerinput); + + if (computerinput==userinput){ + System.out.println("Draw"); + } + else if(computerinput==0&&userinput==2 || computerinput==1&&userinput==0 || computerinput==2&&userinput==1){ + System.out.println("Computer Wins !!"); + } + else{ + System.out.println("You Win !!"); + } + + } +} \ No newline at end of file