@bokomoko/

Confere loteria

C

No description

fork
loading
Files
  • main.c

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.3810174330274043","path":"main.c","file":{"path":"main.c","content":{"asEncoding":{"base64":"I2luY2x1ZGUgPG1hdGguaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnZvaWQgYWNlcnRvcyhpbnQgZ2FiYXJpdG9bXSwgaW50IHJlc3Bvc3RhW10sIGludCBjYXJ0YW8pIHsKCWludCBjb250ID0gMDsKCWZvciAoaW50IHggPSAwOyB4IDwgMTM7IHgrKykgewoJCWNvbnQgKz0gKHJlc3Bvc3RhW3hdID09IGdhYmFyaXRvW3hdKTsKCX0KCXByaW50ZigiTyBhcG9zdGFkb3IgJWQgYWNlcnRvdSAlZFxuIiwgY2FydGFvLCBjb250KTsKCWlmIChjb250ID09IDEzKSB7CgkJcHJpbnRmKCJQYXJhYmVucyB2b2NlIGdhbmhvdSEhIik7Cgl9Cn0KCnZvaWQgbWFpbigpIHsKCWludCBnYWJhcml0b1sxM10gPSB7MSwgMCwgMiwgMiwgMSwgMCwgMSwgMiwgMCwgMSwgMSwgMiwgMH07CglpbnQgY2FydGFvOwoJaW50IHJlc3Bvc3RhWzEzXTsKCWludCB4LCB5OwoJcHJpbnRmKCJEaWdpdGUgbyBudW1lcm8gZG8gc2V1IGNhcnRhbzoiKTsKCXNjYW5mKCIlZCIsICZjYXJ0YW8pOwoKCXByaW50ZigiRGlnaXRlIDAgcGFyYSBzYWlyOlxuIik7Cglmb3IgKHggPSAwOyB4IDwgMTM7IHgrKykgewoJCXByaW50ZigKCQkJIkRpZ2l0ZSBvIHJlc3VsdGFkbyBkbyBqb2dvICVkIDogQ29sdW5hIDEgLSBaZXJvKGVtcGF0ZSkgQ29sdW5hIDIiLAoJCQkoeCArIDEpKTsKCQlzY2FuZigiJWQiLCAmcmVzcG9zdGFbeF0pOwoJfTsKCWFjZXJ0b3MoZ2FiYXJpdG8sIHJlc3Bvc3RhLCBjYXJ0YW8pOwp9Cg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

void acertos(int gabarito[], int resposta[], int cartao) {
	int cont = 0;
	for (int x = 0; x < 13; x++) {
		cont += (resposta[x] == gabarito[x]);
	}
	printf("O apostador %d acertou %d\n", cartao, cont);
	if (cont == 13) {
		printf("Parabens voce ganhou!!");
	}
}

void main() {
	int gabarito[13] = {1, 0, 2, 2, 1, 0, 1, 2, 0, 1, 1, 2, 0};
	int cartao;
	int resposta[13];
	int x, y;
	printf("Digite o numero do seu cartao:");
	scanf("%d", &cartao);

	printf("Digite 0 para sair:\n");
	for (x = 0; x < 13; x++) {
		printf(
			"Digite o resultado do jogo %d : Coluna 1 - Zero(empate) Coluna 2",
			(x + 1));
		scanf("%d", &resposta[x]);
	};
	acertos(gabarito, resposta, cartao);
}