Gabriel Aviña
/
Tarea4_Ejercicio3
Hola
Revision 0:fbe6e5bf1b70, committed 2014-04-10
- Comitter:
- elchef
- Date:
- Thu Apr 10 01:53:25 2014 +0000
- Commit message:
- Hola;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r fbe6e5bf1b70 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 10 01:53:25 2014 +0000 @@ -0,0 +1,36 @@ +//Juan Carlos Verduzco Gastélum A01112580 +//Gabriel Ivan López Aviña A01223680 +#include "mbed.h" +#define SIZE 10 +Serial pc(USBTX, USBRX); + +int valid_ISBN (int *arreglo, int tamaño){ + int suma = 0; + if (arreglo[9] == 'X' || arreglo[9] == 'x'){ + arreglo[9] = 10; + } + for (int index=0; index < tamaño; index = index +1){ + int producto = arreglo[index]*(index+1); + suma += producto; + pc.printf("La suma es: %i", suma); + } + + if(suma%11 == 0){ + return 1; + } + return 0; +} + + +int main(){ + int ISBN[SIZE]={1,6,0,4,5,9,8,9,3,'X'}; + // Art of War: 160459893X + bool prueba; + + prueba = valid_ISBN(ISBN, SIZE); + if (prueba == 1){ + pc.printf("El ISBN es válido"); + } else { + pc.printf("El ISBN es falso"); + } + return 0; \ No newline at end of file
diff -r 000000000000 -r fbe6e5bf1b70 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 10 01:53:25 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e \ No newline at end of file