Created
August 23, 2019 22:34
-
-
Save WadsonGarbes/bcfad7482108aefb9a6d1a788d745bdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int par_ou_impar(char *S) | |
{ | |
int i, j, cont; | |
j = strlen(S); | |
for(i = 0; i < j; i++) | |
{ | |
if(S[i] == '1') | |
cont++; | |
} | |
return (cont % 2) ? 1 : 0; | |
} | |
int main(void) | |
{ | |
char *S; | |
int num; | |
scanf("%s", S); | |
num = par_ou_impar(S); | |
(num) ? puts(strcat(S, "0")) : puts(strcat(S, "1")); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment