Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- main(){
- int num1,num2,tot;
- char play1;
- printf("Jogador 1: I para Impar ou P para Par: ");
- scanf("%c",&play1);
- printf("Informe o numero do primeiro jogador: ");
- scanf("%i",&num1);
- printf("Informe o numero do segundo jogador: ");
- scanf("%i",&num2);
- tot = num1+num2;
- if (play1 != 'p' && play1 != 'i' && play1 != 'I' && play1 != 'P'){
- printf("Fatal error!\n");
- }
- if (tot%2 == 0){
- if (play1 == 'p' || play1 == 'P'){
- printf("Jogador 1 venceu! O total deu %i\n",tot);
- }
- if (play1 == 'i' || play1 == 'I'){
- printf("Jogador 2 venceu! O total deu %i\n",tot);
- }
- }
- else {
- if (play1 == 'p' || play1 == 'P'){
- printf("Jogador 2 venceu! O total deu %i\n",tot);
- }
- if (play1 == 'i' || play1 == 'I'){
- printf("Jogador 1 venceu! O total deu %i\n",tot);
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement