← Back to If Statements
Question 344
Rock Paper Scissors Winner
Rock Paper Scissors Winner
Read two characters withscanf(" %c %c", ...)for player 1 and player 2. Each isR(rock),P(paper), orS(scissors). Rock beats scissors, scissors beats paper, and paper beats rock. Print the result with no trailing newline: printPlayer 1if player 1 wins,Player 2if player 2 wins, orTieif they match. For inputR Sthe output isPlayer 1; forR Pit isPlayer 2; forR Rit isTie.
Expected Output:
Player 1= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.