Created
February 18, 2011 02:26
-
-
Save kaldas/833150 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* Estrutura de Dados e Algoritmos 1 | |
| Prof. Marcelo Vasconcelos - GEC2010N | |
| Aluno: Rodrigo Caldas de Moura Duarte */ | |
| #include "stdio.h" | |
| #include "stdlib.h" | |
| int prmet(int z, int a, int m, int i) | |
| { | |
| if(i == (m - 1)) //sabemos q jamais teremos uma iteracao superior a "m - 1" | |
| return; //que nao seja repetida temos entao nossa condicao de parada =D | |
| i++; | |
| printf("%i\n",z); //dbug | |
| return prmet((a * z % m),a,m,i); | |
| } | |
| int main(int argc, char **argv) | |
| { | |
| if(argc != 4) | |
| { | |
| printf("a entrada deve ser feita pelo argumento ./prog z a m\n"); | |
| printf("para simular sequencia do livro: ./prog 1 7 11\n"); | |
| } else { | |
| prmet(atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),0); | |
| } | |
| return 0x1337; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment