Advertisement
campos20

Untitled

May 2nd, 2020
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. // Switch-case
  6. // Autor: Alexandre Campos
  7.  
  8. int main()
  9. {
  10.     // Declaracao
  11.     int opcao;
  12.  
  13.     // Entrada de dados
  14.     printf("Digite:\n0: Pedra\n1: Papel\n2: Tesoura\n");
  15.     scanf("%d", &opcao);
  16.  
  17.     // Logica e exibicao
  18.     switch(opcao){
  19.         case 0:
  20.             printf("Pedra");
  21.             break;
  22.         case 1:
  23.             printf("Papel");
  24.             break;
  25.         case 2:
  26.             printf("Tesoura");
  27.             break;
  28.         default:
  29.             printf("Opcao invalida.");
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement