Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- void valida()
- {
- int i, r1, r2, soma, seq;
- char cpf[11], d1, d2;
- while(strlen(cpf) != 11)
- {
- printf("Digite um cpf:\n");
- scanf("%s",cpf);
- }
- d1 = cpf[9];
- d2 = cpf[10];
- printf("d1 = %c\t d2 = %c\n", d1,d2);
- for(i=0;i<10;i++)
- {
- soma += ((int) cpf[i] - '0')*seq;
- seq--;
- }
- printf("soma = %d\n",soma);
- }
- int main()
- {
- valida();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement