Commit 9514fc1eb9dcaf17929ad2f3689aa10dce5b5432

Authored by Francisco Javier Coutiño
1 parent 5ec02016e9
Exists in master

p07: Fix numeros pares

07 - Primeros 10001 primos/core
No preview for this file type
07 - Primeros 10001 primos/p07
No preview for this file type
07 - Primeros 10001 primos/p07.cpp
... ... @@ -10,7 +10,7 @@ by: dbk
10 10  
11 11 #include <stdio.h>
12 12  
13   -#define SIZE_ARRAY 10001
  13 +#define SIZE_ARRAY 10002
14 14  
15 15 int main(int argc, char const *argv[])
16 16 {
... ... @@ -53,11 +53,11 @@ int main(int argc, char const *argv[])
53 53 }while(!flgEnd);
54 54 denominador++;
55 55  
56   - } while (arrayPrime[SIZE_ARRAY] == 0);
  56 + } while (arrayPrime[SIZE_ARRAY-1] == 0);
57 57  
58 58 for (int i = 0; i < SIZE_ARRAY; ++i)
59 59 {
60   - printf("%d\t-\t%d\n", i+1, arrayPrime[i-1]);
  60 + printf("%d\t-\t%d\n", i+1, arrayPrime[i]);
61 61 }
62 62  
63 63 printf("El primo #%d es:\t%d\n", SIZE_ARRAY, arrayPrime[SIZE_ARRAY-1]);
... ...