--- /dev/null
+program Volumen_De_Esfera;\r
+\r
+var \r
+ radio, PI: real;\r
+\r
+begin\r
+ PI := 4 * arctan(1);\r
+ write('Ingrese el radio (en cm): ');\r
+ readln(radio);\r
+ writeln('');\r
+ writeln('El volumen de la esfera es: ', (4 / 3) * PI * radio * radio * radio: 8: 2, ' cm3.');\r
+ writeln('La superficie es: ', 4 * PI * radio * radio: 8: 2, ' cm2.');\r
+end.\r
--- /dev/null
+program Cifras_4;\r
+\r
+var\r
+ cant, max, min, max_veces, min_veces, i: word;\r
+ numero: string;\r
+\r
+begin\r
+\r
+max := 0; (********************************)\r
+min := 9999; (* Inicializo algunas variables *)\r
+max_veces := 0; (********************************)\r
+min_veces := 0;\r
+\r
+ write('Qu\82 cantidad de n£meros desea ingresar? ');\r
+ readln(cant);\r
+ for i := 1 to cant do\r
+ begin\r
+ write('Ingrese el n£mero ', cant, '(4 cifras, natural): ');\r
+ readln(actual);\r
+ if actual > 9999 then writeln('El n£mero tiene m s de 4 cifras\r
+\r
--- /dev/null
+PROGRAM ej0216;\r
+\r
+VAR divi, { divisor }\r
+ n: integer; { valor ingesado para dividir }\r
+\r
+BEGIN\r
+ divi := 2;\r
+ write('Escriba un numero para descomponer en numeros primos: ');\r
+ readln(n);\r
+ REPEAT\r
+ IF (n MOD divi) = 0 THEN BEGIN\r
+ writeln(divi: 3); { writeln ('n = ',n);{ para debug }\r
+ n := n DIV divi;\r
+ END\r
+ ELSE divi := divi + 1;\r
+ UNTIL n = 1;\r
+END.\r
+\r
--- /dev/null
+PROGRAM CalculaCoseno;\r
+\r
+VAR\r
+ x: real;\r
+\r
+(****************************************************************************)\r
+(* Funci¢n Potencia: calcula un real elevado a un exponente entero positivo *)\r
+(****************************************************************************)\r
+\r
+FUNCTION potencia(base: real; expo: integer): real;\r
+\r
+VAR\r
+ final: real;\r
+ i: integer;\r
+\r
+BEGIN\r
+ final := 1;\r
+ IF expo <> 0 THEN FOR i := 1 TO expo DO final := final * base;\r
+ writeln('potencia = ', final); (* Para Debug *)\r
+ potencia := final;\r
+END;\r
+\r
+(****************************************************************************)\r
+(* Funcion Factorial: Dado un numero devuelve su factorial. *)\r
+(****************************************************************************)\r
+\r
+FUNCTION factorial(numero: integer): real;\r
+\r
+VAR\r
+ i: integer;\r
+ final: real;\r
+\r
+BEGIN\r
+ final := 1;\r
+ IF numero <> 0 THEN FOR i := 1 TO numero DO final := final * i;\r
+ writeln('factorial = ', final); (* Para debug *)\r
+ factorial := final;\r
+END;\r
+\r
+(****************************************************************************)\r
+(* Funcion Coseno: dado un ngulo en radianes calcula el seno aproximandolo *)\r
+(****************************************************************************)\r
+\r
+FUNCTION coseno(angulo: real): real;\r
+\r
+VAR\r
+ cose, valor: real;\r
+ termino: integer;\r
+\r
+BEGIN\r
+ writeln('angulo = ', angulo); (* Para Debug *)\r
+ cose := 1;\r
+ FOR termino := 1 TO 50 DO BEGIN\r
+ valor := potencia(angulo, termino * 2) / factorial(termino * 2);\r
+ IF (termino MOD 2) = 0 THEN BEGIN\r
+ IF (termino MOD 4) <> 0 THEN valor := - valor;\r
+ cose := cose + valor;\r
+ writeln('coseno actual = ', cose); (*Para Debug *) END;\r
+ END;\r
+ coseno := cose;\r
+END;\r
+\r
+(****************************************************************************)\r
+(* Comienzo del Programa Principal *)\r
+(****************************************************************************)\r
+\r
+BEGIN\r
+ write('Ingrese un ngulo en radianes: ');\r
+ readln(x);\r
+ writeln('El coseno calculado de ', x: 4: 3, ' es ', coseno(x), '.');\r
+ writeln('El coseno ''real'' es ', cos(x), ' y coseno de pi/2 es ', cos((arctan(1) * 4)/2));\r
+END.\r
--- /dev/null
+program ejercicioA;\r
+\r
+const\r
+ max = 200;\r
+\r
+type\r
+ matriz = array[1..max, 1..max] of integer;\r
+\r
+(***********************************************************************)\r
+\r
+function GetPrimo( n: integer ): integer;\r
+\r
+ var\r
+ primo: boolean;\r
+ i: integer;\r
+\r
+ begin\r
+ primo := false;\r
+ while not primo do\r
+ begin\r
+ primo := true;\r
+ for i:= 2 to trunc( sqrt( n ) ) + 1 do\r
+ if ( n mod i ) = 0 then primo := false;\r
+ if not primo then n := n + 1;\r
+ end;\r
+\r
+ GetPrimo := n;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+procedure CargaMatriz( var mat: matriz; tope: integer );\r
+\r
+ var\r
+ prim, i, j: integer;\r
+\r
+ begin\r
+ prim := 1;\r
+ for i := 1 to tope do\r
+ for j := 1 to tope do\r
+ begin\r
+ mat[i,j] := GetPrimo( prim + 1 );\r
+ prim := mat[i,j];\r
+ end;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+procedure MuestraMatriz( var mat: matriz; tope: integer);\r
+\r
+ var\r
+ i, j: integer;\r
+\r
+ begin\r
+ for i := 1 to tope do\r
+ begin\r
+ for j := 1 to tope do\r
+ write( mat[i,j] : 7 );\r
+ writeln;\r
+ end;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+procedure RecorreMatriz( var mat: matriz; mn, mx: integer );\r
+\r
+ procedure RecMat( var mat: matriz; mn, mx: integer );\r
+\r
+ var\r
+ i, j: integer;\r
+\r
+ begin\r
+ if mn <= mx then\r
+ begin\r
+ for j := mn to mx do\r
+ write( mat[mn,j] : 1, ', ' );\r
+ for i := mn + 1 to mx do\r
+ write( mat[i,mx] : 1, ', ' );\r
+ for j := mx - 1 downto mn do\r
+ write( mat[mx,j] : 1, ', ' );\r
+ for i := mx - 1 downto mn + 1 do\r
+ write( mat[i,mn] : 1, ', ' );\r
+ RecMat( mat, mn + 1, mx - 1 );\r
+ end;\r
+ end;\r
+\r
+ begin\r
+ RecMat( mat, mn, mx );\r
+ writeln;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+var\r
+ n: integer;\r
+ mat: matriz;\r
+\r
+begin\r
+ write( 'Ingrese un n£mero (', max : 1, ' m ximo): ' );\r
+ readln( n );\r
+ while n > max do\r
+ begin\r
+ writeln( 'El n£mero que ingres¢ es muy grande, el m ximo es ', max : 1 );\r
+ write( ' Ingrese otro n£mero: ' );\r
+ readln( n );\r
+ end;\r
+ writeln;\r
+ writeln( ' Cargando Matriz...' );\r
+ writeln;\r
+ CargaMatriz( mat, n );\r
+ { MuestraMatriz( mat, n ); }\r
+ writeln;\r
+ writeln( ' Matriz cargada.' );\r
+ writeln;\r
+ RecorreMatriz( mat, 1, n );\r
+end.\r
+\r
--- /dev/null
+program ejercicioB;\r
+\r
+const\r
+ max = 10;\r
+\r
+type\r
+ persona = record\r
+ apellido: string[30];\r
+ telefono: string[20];\r
+ end;\r
+\r
+ matriz = array[1..max, 1..max] of persona;\r
+\r
+\r
+(***********************************************************************)\r
+\r
+procedure Rotar90Matriz( var mat: matriz; mn, mx: integer );\r
+\r
+ type\r
+ vector = array[1..max] of persona;\r
+\r
+ var\r
+ i: integer;\r
+ vtemp: vector;\r
+\r
+ begin\r
+ if mn < mx then\r
+ begin\r
+ for i := mn to mx - 1 do\r
+ vtemp[i] := mat[mn,i];\r
+ for i := mn to mx - 1 do\r
+ mat[mn,i] := mat[i,mx];\r
+ for i := mn + 1 to mx do\r
+ mat[mx+1-i,mx] := mat[mx,i];\r
+ for i := mn + 1 to mx do\r
+ mat[mx,i] := mat[i,mn];\r
+ for i := mn to mx - 1 do\r
+ mat[mx+1-i,mn] := vtemp[i];\r
+ Rotar90Matriz( mat, mn + 1, mx - 1 );\r
+ end;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+procedure MostrarMatriz( var mat: matriz; tope: integer);\r
+\r
+ var\r
+ i, j: integer;\r
+\r
+ begin\r
+ for i := 1 to tope do\r
+ begin\r
+ for j := 1 to tope do\r
+ write( ' (', mat[i,j].apellido, ', ', mat[i,j].telefono, ') ' );\r
+ writeln;\r
+ end;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+procedure CargarMatriz( var mat: matriz; tope: integer );\r
+\r
+ var\r
+ i, j: integer;\r
+\r
+ begin\r
+ for i := 1 to tope do\r
+ for j := 1 to tope do\r
+ begin\r
+ write( 'Ingrese el nobre: ' );\r
+ readln( mat[i,j].apellido );\r
+ write( 'Ingrese el telefono: ' );\r
+ readln( mat[i,j].telefono );\r
+ end;\r
+ end;\r
+\r
+(***********************************************************************)\r
+\r
+\r
+var\r
+ mat: matriz;\r
+ n, i: integer;\r
+\r
+begin\r
+ write( 'Ingrese el tama¤o de la matriz (', max : 1, ' m ximo): ' );\r
+ readln( n );\r
+ while n > max do\r
+ begin\r
+ writeln( 'El n£mero que ingres¢ es muy grande, el m ximo es ', max : 1 );\r
+ write( ' Ingrese otro n£mero: ' );\r
+ readln( n );\r
+ end;\r
+ CargarMatriz( mat, n );\r
+ for i := 1 to 4 do\r
+ begin\r
+ MostrarMatriz( mat, n );\r
+ Rotar90Matriz( mat, 1, n );\r
+ writeln;\r
+ end;\r
+end.\r
--- /dev/null
+program BinAHex;\r
+\r
+function pot(base, exp: integer): integer;\r
+\r
+begin\r
+ if exp > 0 then pot := base * pot(base, exp - 1)\r
+ else pot := 1;\r
+end;\r
+\r
+var\r
+ bin, hex: string[255];\r
+ aux: string[4];\r
+ i, j, dhex, tam, veces: integer;\r
+\r
+begin\r
+ write('Ingrese un numero binario: ');\r
+ readln(bin);\r
+ aux := '0000';\r
+ hex := '';\r
+ tam := length(bin);\r
+ while tam > 0 do\r
+ begin\r
+ if tam mod 4 = 0 then veces := tam div 4\r
+ else veces := (tam div 4) + 1;\r
+ for j := 0 to (veces - 1) do\r
+ begin\r
+ aux[4] := bin[tam-j*4];\r
+ for i := 1 to 3 do\r
+ if (tam - i - j*4) > 0\r
+ then aux[4 - i] := bin[tam - i - j*4]\r
+ else aux[4 - i] := '0';\r
+ dhex := 0;\r
+ for i := 0 to 3 do\r
+ if aux[4-i] = '1' then dhex := dhex + pot(2, i);\r
+ case dhex of\r
+ 0: hex := hex + '0';\r
+ 1: hex := hex + '1';\r
+ 2: hex := hex + '2';\r
+ 3: hex := hex + '3';\r
+ 4: hex := hex + '4';\r
+ 5: hex := hex + '5';\r
+ 6: hex := hex + '6';\r
+ 7: hex := hex + '7';\r
+ 8: hex := hex + '8';\r
+ 9: hex := hex + '9';\r
+ 10: hex := hex + 'A';\r
+ 11: hex := hex + 'B';\r
+ 12: hex := hex + 'C';\r
+ 13: hex := hex + 'D';\r
+ 14: hex := hex + 'E';\r
+ 15: hex := hex + 'F';\r
+ end;\r
+ end;\r
+ write('Numero en hexa: ');\r
+ for i := veces downto 1 do write(hex[i]);\r
+ writeln;\r
+ tam := 0;\r
+ end;\r
+\r
+end.\r
--- /dev/null
+PROGRAM Ej0254;\r
+\r
+VAR\r
+ a, b, total, si_a, si_b: integer;\r
+ aux: real;\r
+ sigo: boolean;\r
+\r
+BEGIN\r
+ total := 0;\r
+ si_a := 0;\r
+ si_b := 0;\r
+ write( 'Para terminar de ingresar valores, ingrese un numero no v lido' );\r
+ write( 'Ecriba 1 si le gusto el producto A (0 si no le gusto): ' );\r
+ readln( a );\r
+ write( 'Ecriba 1 si le gusto el producto B (0 si no le gusto): ' );\r
+ readln( b );\r
+ sigo := ( ( a = 1 ) OR ( a = 0 ) ) AND ( ( b = 1 ) OR ( b = 0 ) );\r
+ WHILE sigo DO\r
+ BEGIN\r
+ total := total + 1;\r
+ IF a = 1 THEN si_a := si_a + 1;\r
+ IF a = 1 THEN si_a := si_a + 1;\r
+ writeln;\r
+ write( ' A: ' );\r
+ readln( a );\r
+ write( ' B: ' );\r
+ readln( b );\r
+ sigo := ( ( a = 1 ) OR ( a = 0 ) ) AND ( ( b = 1 ) OR ( b = 0 ) );\r
+ END;\r
+ IF total > 0 THEN\r
+ BEGIN\r
+ writeln( 'Total ' , total );\r
+ writeln( 'Aceptaron al A el ' , ( si_a / total ) * 100 , ' %' );\r
+ aux := ( ( si_b - si_a ) / total ) * 100;\r
+ IF aux > 0 THEN writeln( 'Aceptaron s¢lo a B el ' , aux , ' %' )\r
+ ELSE writeln( 'Nadie acept¢ s¢lo al B' );\r
+ aux := ( ( si_a - si_b ) / total ) * 100;\r
+ IF aux > 0 THEN writeln( 'Aceptaron s¢lo a A el ' , aux , ' %' )\r
+ ELSE writeln( 'Nadie acept¢ s¢lo al A' );\r
+ IF si_a > si_b THEN aux := ( si_a / total ) * 100\r
+ ELSE aux := ( si_b / total ) * 100;\r
+ writeln( 'Aceptaron alguno de los 2 productos el ' , aux , ' %' );\r
+ aux := ( ( total - aux ) / total ) * 100;\r
+ writeln( 'No aceptaron ninguno el ' , aux , ' %' );\r
+ writeln( 'Aceptaron por lo menos a B el ' , ( si_b / total ) * 100 , ' %' );\r
+ END\r
+ ELSE writeln( 'No se ingresaron valores.' );\r
+END.\r
--- /dev/null
+PROGRAM CalcularMCDyMCM;\r
+\r
+VAR a, b: integer;\r
+\r
+{*********************************************}\r
+{ Funcion que calcula el Maximo Comun Divisor }\r
+{*********************************************}\r
+\r
+FUNCTION MCD(a, b: integer): integer;\r
+\r
+VAR resto: integer;\r
+\r
+BEGIN\r
+ IF a < b THEN BEGIN\r
+ resto := a;\r
+ a := b;\r
+ b := resto;\r
+ END;\r
+ resto := a MOD b;\r
+ WHILE resto <> 0 DO BEGIN\r
+ a := b;\r
+ b := resto;\r
+ resto := a MOD b;\r
+ END;\r
+ MCD := b;\r
+END;\r
+\r
+{**********************************************}\r
+{ Funcion que calcula el Minimo Comun Multiplo }\r
+{**********************************************}\r
+\r
+FUNCTION MCM(a, b: integer): integer;\r
+\r
+BEGIN\r
+ MCM := (a * b) DIV (MCD(a, b));\r
+END;\r
+\r
+{********************************}\r
+{ Comienza el programa principal }\r
+{********************************}\r
+\r
+BEGIN\r
+ write('Ingrese un numero: ');\r
+ readln(a);\r
+ write('Ingrese otro numero: ');\r
+ readln(b);\r
+ writeln;\r
+ writeln('El M¡nimo Com£n M£ltiplo es: ', MCM(a, b): 3);\r
+ writeln('El M ximo Com£n Divisor es: ', MCD(a, b): 3);\r
+END.\r
--- /dev/null
+program MaxComDiv;\r
+\r
+function mcd( a, b: integer ): integer;\r
+\r
+var\r
+ aux: integer;\r
+\r
+begin\r
+ if a < b then\r
+ begin\r
+ aux := a;\r
+ a := b;\r
+ b := aux;\r
+ end;\r
+ if (a mod b) <> 0 then\r
+ mcd := mcd( b, a mod b )\r
+ else\r
+ mcd := b;\r
+end;\r
+\r
+const\r
+ MAX = 5;\r
+\r
+type\r
+ arr = array[1..MAX] of integer;\r
+\r
+var\r
+ numero: arr;\r
+ i: integer;\r
+\r
+begin\r
+ for i := 1 to MAX do\r
+ begin\r
+ write("Ingrese el ", i : 1, "§ numero: ");\r
+ readln(numero[i]);\r
+ end;\r
+ for i := 1 to max - 1 do\r
+ writeln("El MCD de ", numero[i] : 1, " y ", numero[i+1] : 1, " es ", mcd(numero[i], numero[i+1]) : 1);\r
+end.\r
--- /dev/null
+PROGRAM Promedios;\r
+\r
+VAR\r
+ nombre, mPromedio1, mPromedio2: string[20];\r
+ edad, total, aprobados: integer;\r
+ nota1, nota2, promedio, mProm1, mProm2: real;\r
+ hayViejos: boolean;\r
+\r
+BEGIN\r
+ mProm1 := 0;\r
+ mProm2 := 0;\r
+ hayViejos := false;\r
+ total := 0;\r
+ aprobados := 0;\r
+\r
+ write( 'Escriba el nombre del alumno ( ''*'' para terminar): ' );\r
+ readln( nombre );\r
+ WHILE nombre <> '*' DO\r
+ BEGIN\r
+ total := total + 1;\r
+ write( 'Escriba la edad: ' );\r
+ readln( edad );\r
+ write( 'Escriba la primera nota: ' );\r
+ readln( nota1 );\r
+ write( 'Escriba la segunda nota: ' );\r
+ readln( nota2 );\r
+ promedio := ( nota1 + nota2 ) / 2;\r
+ IF edad > 40 THEN hayViejos := true;\r
+ IF promedio >= 4 THEN aprobados := aprobados + 1;\r
+ IF promedio > mProm1\r
+ THEN BEGIN\r
+ mProm1 := promedio;\r
+ mPromedio1 := nombre;\r
+ END\r
+ ELSE IF promedio > mProm2\r
+ THEN BEGIN\r
+ mProm2 := promedio;\r
+ mPromedio2 := nombre;\r
+ END;\r
+ writeln;\r
+ write( 'Escriba el nombre del siguiente alumno (''*'' para terminar): ' );\r
+ readln( nombre );\r
+ END;\r
+ IF total = 0 THEN writeln( 'No se ingresaron datos.' )\r
+ ELSE BEGIN\r
+ writeln( 'El ' , ( aprobados / total ) * 100 : 3 : 2 , '% de los alumnos aprobaron.' );\r
+ IF hayViejos THEN writeln ( 'Hay alumnos de m s de 40 a¤os.' );\r
+ writeln( 'El mejor promedio lo obtuvo ' , mPromedio1 , '.' );\r
+ IF mPromedio2 <> '' THEN writeln( 'El segundo mejor promedio lo obtuvo ' , mPromedio2 , '.' );\r
+ END;\r
+END.\r
--- /dev/null
+program recup;\r
+\r
+function pot2( exp: integer ): integer;\r
+\r
+ var\r
+ j, resultado: integer;\r
+\r
+ begin\r
+ resultado := 1;\r
+ if exp > 0 then for j := 1 to exp do resultado := resultado * 2;\r
+ pot2 := resultado;\r
+ end;\r
+\r
+var\r
+ num, n: string[255];\r
+ i, dec, tam: integer;\r
+\r
+begin\r
+ write( 'Escriba un numero binario (negativo para terminar): ' );\r
+ readln( num );\r
+ while num[1] <> '-' do\r
+ begin\r
+ tam := length( num );\r
+ n := '';\r
+ dec := 0;\r
+ for i := tam downto 1 do\r
+ n[tam-i+1] := num[i];\r
+ for i := 1 to tam do\r
+ if n[i] = '1' then dec := dec + pot2( i - 1 );\r
+ writeln( 'El numero en base 10 es: ', dec: 1 );\r
+ writeln;\r
+ write( 'Ingrese otro (negativo para terminar): ');\r
+ readln( num );\r
+ end;\r
+ writeln( 'Fin del Programa.' );\r
+end.\r
--- /dev/null
+PROGRAM ;\r
+\r
+VAR\r
+\r
+BEGIN\r
+END.\r
--- /dev/null
+Computing Course\r
+AlgorithmBubble Sort\r
+ Implemented in : Turbo Pascal 6.0 (ish)\r
+ DescriptionBubble sort (Procedure only)\r
+ \r
+Explanation\r
+Warning (Plagiarism)\r
+\r
+\r
+\r
+procedure bubble( list : array_type; n : integer)\r
+flag : boolean;\r
+count, temp : integer\r
+begin\r
+repeat begin\r
+flag := false;\r
+for count in 1 to n loop\r
+if list[count+1] > list[count] \r
+then\r
+....temp := list[count];\r
+....list[count] := list[count + 1];\r
+....list[count + 1] := temp;\r
+....flag := true;\r
+end if;\r
+end loop;\r
+until flag=false;\r
+end bubble;\r
+\r
+\r
+\r
+\r
+Explanation : Bubble Sort\r
+list is the array we are sorting,\r
+n is the number of elements in the array.\r
+First you set the "flag" to false to say there have been ne swaps.\r
+loop around between 1 and the number of elements in the array.\r
+for each loop test that position against the next position to see if a swap is \r
+needed, \r
+if so then swap the items over using the temporary variable temp.\r
+set flag to true to say there has been a swap this pass,\r
+Once the array has been checked once, ie count has gone between 1 and n, if \r
+there are no swaps done everything is in order and we drop out of the array, if \r
+flag is true then we "repeat" the whole process again, until no swaps are \r
+made...\r
+This process can be made slightly quicker, on the first pass the highest number \r
+will always "float" to the top end of the array, therefore this element needn't \r
+be checked next pass around, simmerly on the second pass, two numbers at the top \r
+of the array will be in order... slowly decreasing the number of items needing \r
+to be checked. Another variable "bottom" can be included here to do this it's \r
+incremented every pass, and on the next pass you loop "1 to n-bottom" times.\r
+If you need any furthur help with this don't hesitate in contacting me... I'll \r
+try to help.\r
--- /dev/null
+program dividir;\r
+\r
+\r
+{ En este procedimiento es imprecindible que el valor pasado\r
+ como argumento de resultado este inicializado a 0 (cero).\r
+}\r
+\r
+procedure divi( numerador, divisor: integer; var resultado, resto: integer );\r
+\r
+begin\r
+ resto := numerador - divisor;\r
+ if resto >= 0 then\r
+ begin\r
+ resultado := resultado + 1;\r
+ divi( resto, divisor, resultado, resto );\r
+ end\r
+ else\r
+ resto := divisor + resto;\r
+end;\r
+\r
+var\r
+ resto, result, divis, num: integer;\r
+\r
+begin\r
+ resto := 0;\r
+ result := 0;\r
+ writeln(" Este programa realiza la divisi¢n entre dos n£meros naturales.");\r
+ write("Ingrese el numerador: ");\r
+ readln(num);\r
+ write("Ingrese el divisor: ");\r
+ readln(divis);\r
+ divi(num, divis, result, resto);\r
+ writeln(" El cociente es: ", result : 1);\r
+ writeln(" El resto es: ", resto : 1);\r
+end.\r
--- /dev/null
+PROGRAM ForDownto;\r
+\r
+VAR i: integer;\r
+\r
+BEGIN\r
+ FOR i := 5 DOWNTO 0 DO writeln(i);\r
+END.\r
--- /dev/null
+<html>\r\r
+\r\r
+<head>\r\r
+<meta name="Template" content="C:\ARCHIVOS DE PROGRAMA\MICROSOFT OFFICE\OFFICE\html.dot">\r\r
+<meta name="GENERATOR" content="Microsoft FrontPage 3.0">\r\r
+<title>Práctica N°1 - ejercicios 1 al 11</title>\r\r
+</head>\r\r
+\r\r
+<body bgcolor="#FFFFFF" link="#0000FF" vlink="#800080">\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p align="right"><a href="../index.html" target="_top"><img src="netdome.gif" alt="netdome.gif (11332 bytes)" border="0" WIDTH="96" HEIGHT="48"></a></p>\r\r
+\r\r
+<p><a href="index.html">Volver a la página principal</a> <a href="sistemas_2.htm">Ejercicios\r\r
+12-23</a></p>\r\r
+\r\r
+<hr align="left">\r\r
+\r\r
+<table border="1" width="100%">\r\r
+ <tr>\r\r
+ <td width="8%">Ejercicios</td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_1">1</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_2">2</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_3">3</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_4">4</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_5">5</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_6">6</a></td>\r\r
+ <td width="8%"><a href="sistemas_1.htm#ejercicio_7">7</a></td>\r\r
+ <td width="9%"><a href="sistemas_1.htm#ejercicio_8">8</a></td>\r\r
+ <td width="9%"><a href="sistemas_1.htm#ejercicio_9">9</a></td>\r\r
+ <td width="9%"><a href="sistemas_1.htm#ejercicio_10">10</a></td>\r\r
+ <td width="9%"><a href="sistemas_1.htm#ejercicio_11">11</a></td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p align="center">(n) significa "en base n"</p>\r\r
+\r\r
+<p align="center">^ significa "elevado a"</p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_1">Ejercicio 1)</a></p>\r\r
+\r\r
+<p>Pasar a base 10 los siguientes números, de las bases indicadas:</p>\r\r
+\r\r
+<p>1101 (2) = 2³ * 1 + 2² * 1 + 21 * 0 + 20 * 1 = 8 + 4 + 1 = 13</p>\r\r
+\r\r
+<p>0.101 (2) = 2-1 * 1 + 2-3 * 1 = 0.5 + 0.125 = 0.625</p>\r\r
+\r\r
+<p>101.11 (2) = 2² * 1 + 20 * 1 + 2-1 * 1 + 2-2 * 1= 4 + 1 + 0.5 + 0.25 = 5.75</p>\r\r
+\r\r
+<p>1.0111 (2) = 20 * 1 + 2-2 * 1 + 2-3 * 1 + 2-4 * 1 = 1 + 0.25 + 0.125 + 0.0625 = 1.4375</p>\r\r
+\r\r
+<p>753 (8) = 8² * 7 + 81 * 5 + 80 * 3 = 448 + 40 + 3 = 491</p>\r\r
+\r\r
+<p>0.63 (8) = 8-1 * 6 + 8-2 * 3 = 0.796875</p>\r\r
+\r\r
+<p>17.134 (8) = 81 * 1 + 80 * 7 + 8-1 * 1 + 8-2 * 3 + 8-3 * 4 = 8 + 7 +0.125 + 0.0078125 +\r\r
+0.046875 = 15.0078125</p>\r\r
+\r\r
+<p>3A (16) = 161 * 3 + 160 * 10 = 48 + 10= 58</p>\r\r
+\r\r
+<p>0.FF (16) = 16-1 * 1 + 16-2 * 1 = 0.0625 + 0.00390625 = 0.06640625</p>\r\r
+\r\r
+<p>A5.3B (16) = 161 * 15 + 160 * 5 + 16-1 * 3 + 16-2 * 11 = 240 + 5 + 0.1875 + 0.04296875\r\r
+= 245.23046875</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_2">Ejercicio 2</a>)</p>\r\r
+\r\r
+<p>Pasar los siguientes números de base 10 a la base indicada</p>\r\r
+\r\r
+<p>39(2)</p>\r\r
+\r\r
+<p>39 div 2 = 19 resto = 1</p>\r\r
+\r\r
+<p>19 div 2 = 9 resto = 1</p>\r\r
+\r\r
+<p>9 div 2 = 4 resto = 1</p>\r\r
+\r\r
+<p>4 div 2 = 2 resto = 0</p>\r\r
+\r\r
+<p>2 div 2 = 1 resto = 0</p>\r\r
+\r\r
+<p>39 en base 10 = 10011 en base 2</p>\r\r
+\r\r
+<p>Comprobación: 25 * 1 + 24 * 0 + 2³ * 0 + 2² * 1 + 2^1 * 1 + 2^0 * 1 = 32 + 4 + 2 + 1\r\r
+= 39 </p>\r\r
+\r\r
+<p>0.525(2) </p>\r\r
+\r\r
+<p>0.525*2=1.05</p>\r\r
+\r\r
+<p>0.05*2=0.1</p>\r\r
+\r\r
+<p>0.1*2=0.2</p>\r\r
+\r\r
+<p>0.2*2=0.4</p>\r\r
+\r\r
+<p>0.4*2=0.8</p>\r\r
+\r\r
+<p>0.8*2=1.6</p>\r\r
+\r\r
+<p>0.6*2=1.2</p>\r\r
+\r\r
+<p>Si continúo operando se repite la secuencia a partir de 0.2*2, en consecuencia este\r\r
+número no tiene representación finita en base 2, con lo cual si aplico el teorema\r\r
+fundamental obtengo una aproximación.</p>\r\r
+\r\r
+<p>23.945(2)</p>\r\r
+<div align="left">\r\r
+\r\r
+<table border="0">\r\r
+ <tr>\r\r
+ <td width="200"><p align="left">23 div 2= 11 resto 1</p>\r\r
+ <p align="left">11 div 2= 5 resto 1</p>\r\r
+ <p align="left">5 div 2= 2 resto 1</p>\r\r
+ <p align="left">2 div 2= 1 resto 0</td>\r\r
+ <td width="200"><p align="left">0.78 *2=1.56</p>\r\r
+ <p align="left">0.56 *2=1.12</p>\r\r
+ <p align="left">0.945*2=1.89</p>\r\r
+ <p align="left">0.89 *2=1.78</td>\r\r
+ </tr>\r\r
+</table>\r\r
+</div>\r\r
+\r\r
+<p>23.945 en base 10 = 10111.1111 en base 2</p>\r\r
+\r\r
+<p>123(8)</p>\r\r
+\r\r
+<p>123 div 8 = 15 resto=3</p>\r\r
+\r\r
+<p>15 div 8 = 1 resto=7 </p>\r\r
+\r\r
+<p>1< 8; entonces no continúo con el algoritmo</p>\r\r
+\r\r
+<p>123 en base 10 = 173 en base 8</p>\r\r
+\r\r
+<p>3.1(8) </p>\r\r
+\r\r
+<p>0.1 * 8 = 0.8</p>\r\r
+\r\r
+<p>0.8 * 8 = 6.4</p>\r\r
+\r\r
+<p>0.4 * 8 = 3.2</p>\r\r
+\r\r
+<p>0.2 * 8 = 1.6</p>\r\r
+\r\r
+<p>0.6 * 8 = 4.8</p>\r\r
+\r\r
+<p>3.1 en base 2 = 3.06314 en octal</p>\r\r
+\r\r
+<p>0.14(8)</p>\r\r
+\r\r
+<p>0.14 * 8 = 1.12</p>\r\r
+\r\r
+<p>0.12 * 8 = 0.96</p>\r\r
+\r\r
+<p>0.96 * 8 =7.98</p>\r\r
+\r\r
+<p>0.14 en base 10 = 0.1070 en octal</p>\r\r
+\r\r
+<p>1068(16)</p>\r\r
+\r\r
+<p>1068 en base 10 = 42C</p>\r\r
+\r\r
+<p>61.6(16)</p>\r\r
+\r\r
+<p>61 div 16 = 3 resto = 13</p>\r\r
+\r\r
+<p>0.6 * 16 = 9.6</p>\r\r
+\r\r
+<p>0.6 * 16 = 9.6</p>\r\r
+\r\r
+<p>61.6 en base 10 = 3D.999 en base 16; este es un ejemplo de un número periódico en\r\r
+hexadecimal</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_3">Ejercicio 3)</a></p>\r\r
+\r\r
+<p>Pasar el siguiente decimal a la base indicada con un error menor o igual al indicado</p>\r\r
+\r\r
+<table border="1" cellpadding="3" width="734" bordercolor="#000000">\r\r
+ <tr>\r\r
+ <td valign="top" width="21%">Número </td>\r\r
+ <td valign="top" width="15%">Base</td>\r\r
+ <td valign="top" width="13%">Error</td>\r\r
+ <td valign="top" width="26%">N </td>\r\r
+ <td valign="top" width="26%">Resultado </td>\r\r
+ </tr>\r\r
+ <tr>\r\r
+ <td valign="top" width="21%">0.267</td>\r\r
+ <td valign="top" width="15%">2</td>\r\r
+ <td valign="top" width="13%">0.001</td>\r\r
+ <td valign="top" width="26%">10</td>\r\r
+ <td valign="top" width="26%">0,0100010001</td>\r\r
+ </tr>\r\r
+ <tr>\r\r
+ <td valign="top" width="21%">52.38</td>\r\r
+ <td valign="top" width="15%">2</td>\r\r
+ <td valign="top" width="13%">0.0001</td>\r\r
+ <td valign="top" width="26%">14</td>\r\r
+ <td valign="top" width="26%">110100,01100001010001</td>\r\r
+ </tr>\r\r
+ <tr>\r\r
+ <td valign="top" width="21%">129.64</td>\r\r
+ <td valign="top" width="15%">2</td>\r\r
+ <td valign="top" width="13%">0.1</td>\r\r
+ <td valign="top" width="26%">4</td>\r\r
+ <td valign="top" width="26%">10000001,101</td>\r\r
+ </tr>\r\r
+ <tr>\r\r
+ <td valign="top" width="21%">163.97</td>\r\r
+ <td valign="top" width="15%">8</td>\r\r
+ <td valign="top" width="13%">0.0001</td>\r\r
+ <td valign="top" width="26%">5</td>\r\r
+ <td valign="top" width="26%">243,7605</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p>a)</p>\r\r
+\r\r
+<p>0.267</p>\r\r
+\r\r
+<p>0.267*2=0.534</p>\r\r
+\r\r
+<p>0.534*2=1.068</p>\r\r
+\r\r
+<p>0.068*2=0.136</p>\r\r
+\r\r
+<p>0.136*2=0.272</p>\r\r
+\r\r
+<p>0.272*2=0.544</p>\r\r
+\r\r
+<p>0.544*2=1.088</p>\r\r
+\r\r
+<p>0.088*2=0.176</p>\r\r
+\r\r
+<p>0.176*2=0.352</p>\r\r
+\r\r
+<p>0.352*2=0.704</p>\r\r
+\r\r
+<p>0.704*2=1.408</p>\r\r
+\r\r
+<p>b)</p>\r\r
+\r\r
+<p>52.38</p>\r\r
+\r\r
+<p>52=110100</p>\r\r
+\r\r
+<p>0.38*2=0.76</p>\r\r
+\r\r
+<p>0.76*2=1.52</p>\r\r
+\r\r
+<p>0.52*2=1.04</p>\r\r
+\r\r
+<p>0.04*2=0.08</p>\r\r
+\r\r
+<p>0.08*2=0.16</p>\r\r
+\r\r
+<p>0.16*2=0.32</p>\r\r
+\r\r
+<p>0.32*2=0.64</p>\r\r
+\r\r
+<p>0.64*2=1.28</p>\r\r
+\r\r
+<p>0.28*2=0.56</p>\r\r
+\r\r
+<p>0.56*2=1.12</p>\r\r
+\r\r
+<p>0.12*2=0.24</p>\r\r
+\r\r
+<p>0.24*2=0.48</p>\r\r
+\r\r
+<p>0.48*2=0.96</p>\r\r
+\r\r
+<p>0.96*2=1.92</p>\r\r
+\r\r
+<p>c)</p>\r\r
+\r\r
+<p>129.64</p>\r\r
+\r\r
+<p>129=10000001</p>\r\r
+\r\r
+<p>0.64*2=1.28</p>\r\r
+\r\r
+<p>0.28*2=0.56</p>\r\r
+\r\r
+<p>0.56*2=1.12</p>\r\r
+\r\r
+<p>0.12*2=0.24</p>\r\r
+\r\r
+<p>d)</p>\r\r
+\r\r
+<p>163.97</p>\r\r
+\r\r
+<p>163 div 8=20 r 3</p>\r\r
+\r\r
+<p>20 div 8=2 r 4</p>\r\r
+\r\r
+<p>163=243(8)</p>\r\r
+\r\r
+<p>0.97*8=7.76</p>\r\r
+\r\r
+<p>0.76*8=6.08</p>\r\r
+\r\r
+<p>0.08*8=0.64</p>\r\r
+\r\r
+<p>0.64*8=5.12</p>\r\r
+\r\r
+<p>0.12*8=0.96</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_4">Ejercicio 4)</a></p>\r\r
+\r\r
+<p>Pasar a las bases indicadas usando la propiedad de base de potencia de otra base</p>\r\r
+\r\r
+<p>32 en base 8 => (2) = 011010</p>\r\r
+\r\r
+<p>32 div 2 = 16 resto = 0</p>\r\r
+\r\r
+<p>16 div 2 = 8 resto = 0</p>\r\r
+\r\r
+<p>8 div 2 = 4 resto = 0</p>\r\r
+\r\r
+<p>4 div 2 = 2 resto = 0 </p>\r\r
+\r\r
+<p>2 div 2 = 1 resto = 0 </p>\r\r
+\r\r
+<p>F1 en base 16=>(2) = 11110001</p>\r\r
+\r\r
+<p>73 en base 8 => (16) = 111011(2) = 3B</p>\r\r
+\r\r
+<p>1010 en base 2 => (16)= A</p>\r\r
+\r\r
+<p>10.10 en base 2 => (8) 010.100(2) => 2.4(8)</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_5">Ejercicio 5</a>)</p>\r\r
+\r\r
+<p>Realizar las siguientes sumas:</p>\r\r
+\r\r
+<p>1010(2) + 0101(2) = 1111(2)</p>\r\r
+\r\r
+<p>7354(8) + 1123(8) = 10477(8) ===> 111 011 101 100 (2) + 001 001 010 011 (2) = 001\r\r
+000 100 111 111 (2)</p>\r\r
+\r\r
+<p>F1E5(16) + ABC1(16) = 19DA6(16) ===> 1111 0001 1110 0101 (2) + 1010 1011 1100 0001\r\r
+(2) = 00011001110110100110(2)</p>\r\r
+\r\r
+<p>3231(4) + 2123(4) = 12020(4) ===> 11 10 11 01 (2) + 10 01 10 11 (2) = 01 10 00 10 00\r\r
+(2)</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_6">Ejercicio 6</a>)</p>\r\r
+\r\r
+<p>Realizar las siguientes restas:</p>\r\r
+\r\r
+<p>F91F(16)- 0101(16)= 1111100100011111(2)-0000000100000001(2)</p>\r\r
+\r\r
+<p align="center">= F81E(16) = 1111100000011110(2)</p>\r\r
+\r\r
+<p align="left">0334(8) - 0137(8) = 0175(8)</p>\r\r
+\r\r
+<p>1060(8) - 1776(8) = -272(8)</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_7">Ejercicio 7)</a></p>\r\r
+\r\r
+<p>Realizar las siguientes operaciones por Complemento a la base</p>\r\r
+\r\r
+<table border="0" cellpadding="4" cellspacing="0" width="633">\r\r
+ <tr>\r\r
+ <td align="center" valign="top" width="33%"><p align="right">1 0 0 1 1 1 0 1 (2)</p>\r\r
+ <p align="right">- 0 0 1 1 0 0 1 1 (2)</td>\r\r
+ <td align="center" valign="top" width="33%"><p align="right">0 1 1 1 0 1 0 1 (2)</p>\r\r
+ <p align="right">- 0 0 0 1 1 1 1 1 (2)</td>\r\r
+ <td align="center" valign="top" width="33%"><p align="right">0 0 1 0 0 0 1 1 (2) </p>\r\r
+ <p align="right">- 0 0 0 1 1 0 0 1 (2)</td>\r\r
+ </tr>\r\r
+ <tr>\r\r
+ <td align="center"><p align="right">1 0 0 1 1 1 0 1 (2)</p>\r\r
+ <p align="right">+ 1 1 0 0 1 1 0 1(2)</p>\r\r
+ <p align="right">1 0 1 1 0 1 0 10 (2)</td>\r\r
+ <td align="center"><p align="right">0 1 1 1 0 1 0 1 (2)</p>\r\r
+ <p align="right">+ 1 1 1 0 0 0 0 1(2)</p>\r\r
+ <p align="right">1 0 1 0 1 0 1 1 0(2)</td>\r\r
+ <td align="center"><p align="right"> 0 0 1 0 0 0 1 1 (2) </p>\r\r
+ <p align="right">+ 1 1 1 0 0 1 1 1 (2)</p>\r\r
+ <p align="right">1 0 0 0 0 1 0 1 0 (2)</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_8">Ejercicio 8)</a></p>\r\r
+\r\r
+<p>Realizar las siguientes restan en base 2</p>\r\r
+\r\r
+<table border="0" cellpadding="4" cellspacing="0" width="633">\r\r
+ <tr>\r\r
+ <td valign="top" width="33%"><p align="right">001000</p>\r\r
+ <p align="right">- 000101</p>\r\r
+ <p align="right">000011</td>\r\r
+ <td valign="top" width="33%"><p align="right">11001</p>\r\r
+ <p align="right">- 00111</p>\r\r
+ <p align="right">10010</td>\r\r
+ <td valign="top" width="33%"><p align="right">00110</p>\r\r
+ <p align="right">-11000</p>\r\r
+ <p align="right">Es equivalente a hacer</p>\r\r
+ <p align="right">11000</p>\r\r
+ <p align="right">-00110</p>\r\r
+ <p align="right">10010</p>\r\r
+ <p align="right">Y luego le cambio el signo</p>\r\r
+ <p align="right">-10010</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_9">Ejercicio 9</a>)</p>\r\r
+\r\r
+<p>Realizar los siguientes productos</p>\r\r
+\r\r
+<table border="0" cellpadding="4" cellspacing="0" width="633">\r\r
+ <tr>\r\r
+ <td valign="top" width="33%"><p align="right">0018 (16)</p>\r\r
+ <p align="right">X 100 (16)</p>\r\r
+ <p align="right">001800 (16)</td>\r\r
+ <td valign="top" width="33%"><p align="right">047(8)</p>\r\r
+ <p align="right">X 010(8)</p>\r\r
+ <p align="right">470(8)</td>\r\r
+ <td valign="top" width="33%"><p align="right">0018(18)</p>\r\r
+ <p align="right">X 010(18)</p>\r\r
+ <p align="right">180(18)</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_10">Ejercicio 10)</a></p>\r\r
+\r\r
+<p>Escribir con notación exceso 10000000 2</p>\r\r
+\r\r
+<p>10102</p>\r\r
+\r\r
+<p>10102 + 10000000 = 100010102</p>\r\r
+\r\r
+<p>-F116</p>\r\r
+\r\r
+<p>-11110001(2) necesita más bits para ser representado de los que permite el exceso</p>\r\r
+\r\r
+<p>3014 (8)</p>\r\r
+\r\r
+<p>011000001100 no puede ser representado(idem anterior)</p>\r\r
+\r\r
+<p>-11002</p>\r\r
+\r\r
+<p>00001100</p>\r\r
+\r\r
+<p>10000000</p>\r\r
+\r\r
+<p>10001100</p>\r\r
+\r\r
+<p>Como es negativo; 011100112 + 1 = 011101002</p>\r\r
+\r\r
+<p>-5138 no puede ser representado</p>\r\r
+\r\r
+<p>-3716</p>\r\r
+\r\r
+<p>00100101</p>\r\r
+\r\r
+<p>10000000</p>\r\r
+\r\r
+<p>10100101; 01011010+1=01011011</p>\r\r
+\r\r
+<p><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p><a name="ejercicio_11">Ejercicio 11)</a></p>\r\r
+\r\r
+<p>Escribir como complemento a dos (en 16 bits)</p>\r\r
+\r\r
+<table border="0" cellpadding="4" cellspacing="0" width="633">\r\r
+ <tr>\r\r
+ <td valign="top" width="50%"><p align="right">-4710</p>\r\r
+ <p align="right">0000000000101111</p>\r\r
+ <p align="right">1111111111010000</p>\r\r
+ <p align="right">+1</p>\r\r
+ <p align="right">1111111111010001</td>\r\r
+ <td valign="top" width="50%"><p align="right">-1616 </p>\r\r
+ <p align="right">0000000000010000</p>\r\r
+ <p align="right">1111111111101111</p>\r\r
+ <p align="right">+1</p>\r\r
+ <p align="right">1111111111110000</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p align="right"> </p>\r\r
+\r\r
+<table border="0" cellpadding="4" cellspacing="0" width="633">\r\r
+ <tr>\r\r
+ <td valign="top" width="50%"><p align="right">3510</p>\r\r
+ <p align="right">0000000000100011</td>\r\r
+ <td valign="top" width="50%"><p align="right">F116</p>\r\r
+ <p align="right">0000000011110001</td>\r\r
+ </tr>\r\r
+</table>\r\r
+\r\r
+<p align="left"><a href="sistemas_1.htm#top">Volver al tope de la página</a></p>\r\r
+\r\r
+<hr>\r\r
+\r\r
+<p align="right"><a href="../index.html" target="_top"><img src="netdome.gif" alt="netdome.gif (11332 bytes)" border="0" WIDTH="96" HEIGHT="48"></a></p>\r\r
+\r\r
+<hr>\r\r
+</body>\r\r
+</html>\r\r
--- /dev/null
+(*\r
+ * Programa que consiste en dos funciones, la primera devuelve,\r
+ * a partir de un mes y un a¤o v lido, el numero de dias que tiene\r
+ * dicho mes. La segunda, a partir de un dia, un mes y un anio, da\r
+ * el numero de dias que tiene un mes y retorna 0 si la fecha es\r
+ * invalida. El programa en s¡, toma una fecha y devuelve el dia\r
+ * siguiente. Si la fecha ingresada es invalida, avisa al usuario\r
+ * y sale.\r
+ *\r
+ *)\r
+\r
+PROGRAM Fechas;\r
+\r
+VAR\r
+ dia, mes, anio, dias: integer;\r
+\r
+FUNCTION maxDias(mes, anio: integer): integer;\r
+\r
+ BEGIN\r
+ CASE mes OF\r
+ 2: IF ((anio MOD 4 = 0) AND (anio MOD 100 <> 0)) OR (anio MOD 400 = 0)\r
+ THEN maxDias := 29\r
+ ELSE maxDias := 28;\r
+ 4, 6, 9, 11: maxDias := 30;\r
+ ELSE maxDias := 31;\r
+ END;\r
+ END;\r
+\r
+FUNCTION maxDiasValido(dia, mes, anio: integer): integer;\r
+\r
+ VAR\r
+ max: integer;\r
+\r
+ BEGIN\r
+ IF (anio > 2100) OR (anio < 1900)\r
+ THEN maxDiasValido := 0\r
+ ELSE IF (mes > 12) OR (mes < 1)\r
+ THEN maxDiasValido := 0\r
+ ELSE BEGIN\r
+ max := maxDias(mes, anio);\r
+ IF (dia > max) OR (dia < 1)\r
+ THEN maxDiasValido := 0\r
+ ELSE maxDiasValido := max;\r
+ END;\r
+ END;\r
+\r
+BEGIN\r
+ write('Escriba el dia: ');\r
+ readln(dia);\r
+ write('Escriba el mes: ');\r
+ readln(mes);\r
+ write('Escriba el aÏo: ');\r
+ readln(anio);\r
+ dias := maxDiasValido(dia, mes, anio);\r
+ IF dias = 0\r
+ THEN writeln('La fecha que ingres½ no es vÿlida. Pruebe otra vez...')\r
+ ELSE BEGIN\r
+ IF dia < dias\r
+ THEN dia := dia + 1\r
+ ELSE BEGIN\r
+ dia := 1;\r
+ IF mes = 12\r
+ THEN BEGIN\r
+ anio := anio + 1;\r
+ mes := 1;\r
+ END\r
+ ELSE mes := mes + 1;\r
+ END;\r
+ writeln('El da siguiente es el ', dia: 2, '-', mes: 2, '-', anio: 4, '.');\r
+ END;\r
+END.\r
--- /dev/null
+program fibonacci;\r
+\r
+const\r
+ MAX = 20;\r
+\r
+var\r
+ i, a0, a1, ai: integer;\r
+\r
+begin\r
+ a0 := 0;\r
+ a1 := 1;\r
+ write( a0, a1 );\r
+ for i := 2 to MAX do\r
+ begin\r
+ ai := a0 + a1;\r
+ a0 := a1;\r
+ a1 := ai;\r
+ write( ai );\r
+ end;\r
+end.\r
--- /dev/null
+PROGRAM Fibonacci;\r
+\r
+VAR x1, x2, n, aux: real;\r
+ i: integer;\r
+\r
+\r
+FUNCTION numeroValido(numero: real): boolean;\r
+\r
+BEGIN\r
+ IF numero < 1 THEN numeroValido := false\r
+ ELSE numeroValido := true;\r
+END;\r
+\r
+\r
+BEGIN\r
+ write('Que cantidad de n£meros de la sucesion de Fibonacci desea ver? ');\r
+ readln(n);\r
+ IF numeroValido(n) THEN\r
+ BEGIN\r
+ x1 := 0;\r
+ x2 := 1;\r
+ IF n = 1 THEN writeln(x1)\r
+ ELSE writeln(x1, x2);\r
+ FOR i := 3 TO trunc(n) DO BEGIN\r
+ aux := x2;\r
+ x2 := x1 + x2;\r
+ x1 := aux;\r
+ writeln(x2);\r
+ END;\r
+ END\r
+ ELSE writeln('El n£mero debe ser mayor o igual que 1. Pruebe otra vez...');\r
+END.\r
--- /dev/null
+program salida;\r
+\r
+const\r
+ MAX = 4;\r
+\r
+var\r
+ i, j: integer;\r
+\r
+begin\r
+ for i := 0 to MAX do\r
+ begin\r
+ for j := 0 to i do\r
+ write(chr(65+j));\r
+ writeln;\r
+ end;\r
+end.\r
--- /dev/null
+/*\r
+ * Igual que "loco.pas".\r
+ *\r
+ * NO ANDA, REVISAR!!! ---> YA ANDA JOYA!!!!\r
+ *\r
+ */\r
+\r
+#include <iostream.h>\r
+#include <stdio.h>\r
+\r
+int main()\r
+{\r
+ bool haydoblecero = false, haycero = false;\r
+ int n = 0, suma = 0, max = -32768;\r
+\r
+ do\r
+ {\r
+ cout << "Ingrese un numero (dos 0 seguidos para finalizar): ";\r
+ cin >> n;\r
+ if (n == 0)\r
+ {\r
+ if (haycero) haydoblecero = true;\r
+ else\r
+ {\r
+ haycero = true;\r
+ if (suma >= max) max = suma;\r
+ suma = 0;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ suma += n;\r
+ haycero = false;\r
+ }\r
+ // cout << "max = " << max << " | suma = " << suma; // Para debug,\r
+ // cout << " | n = " << " | hayc = " << haycero; // muestra el estado\r
+ // cout << " | haydc = " << haydoblecero << endl; // de las variables\r
+ } while (!(haydoblecero));\r
+ cout << "La suma mayor es: " << max << endl;\r
+ return 0;\r
+}
\ No newline at end of file
--- /dev/null
+(*************************************************************************)\r
+(* *)\r
+(* Programa Loco: se ingresa una sucesion de numeros. Se utilizan los *)\r
+(* ~~~~~~~~~~~~~~ ceros (0) para separar. Lo que se encuentra entre ce- *)\r
+(* ros se suma. Ingresando dos ceros seguidos se finaliza la entrada de *)\r
+(* datos. Al finalizar el programa, imprime el valor de la suma m s alta *)\r
+(* *)\r
+(*************************************************************************)\r
+\r
+PROGRAM Loco;\r
+\r
+VAR\r
+ haydoblecero, haycero: boolean;\r
+ n, ante, suma, max: integer;\r
+\r
+BEGIN\r
+ haycero := false;\r
+ haydoblecero := false;\r
+ max := -MAXINT;\r
+ suma := 0;\r
+ writeln('Ingrese una sucesion de n£meros, ingrese dos ceros seguidos para finalizar.');\r
+ REPEAT\r
+ write('Ingrese un n£mero: ');\r
+ readln(n);\r
+ IF n = 0 THEN IF haycero THEN haydoblecero := true\r
+ ELSE BEGIN\r
+ haycero := true;\r
+ IF suma >= max THEN max := suma;\r
+ suma := 0;\r
+ END\r
+ ELSE BEGIN\r
+ suma := suma + n;\r
+ haycero := false;\r
+ END;\r
+ UNTIL haydoblecero;\r
+ writeln('La suma mayor es ', max,'.');\r
+END.\r
--- /dev/null
+program numeros_alreves;\r
+\r
+const\r
+ MAX = 5;\r
+\r
+var\r
+ i, j: integer;\r
+\r
+begin\r
+ for i := MAX downto 1 do\r
+ begin\r
+ for j := 1 to i do\r
+ write( j: 2 );\r
+ writeln;\r
+ end;\r
+end.\r
--- /dev/null
+PROGRAM DecABin;\r
+\r
+VAR\r
+ binario: string[255];\r
+ numero: integer;\r
+ resto: integer;\r
+ result: integer;\r
+ i: integer;\r
+\r
+BEGIN\r
+ write('Ingrese el numero entero decimal a convertir (-1 termina): ');\r
+ readln(numero);\r
+ WHILE numero >= 0 DO\r
+ BEGIN\r
+ binario := '';\r
+ resto := numero MOD 2;\r
+ result := numero DIV 2;\r
+ WHILE result > 1 DO\r
+ BEGIN\r
+ IF resto = 1 THEN binario := binario + '1'\r
+ ELSE binario := binario + '0';\r
+ resto := result MOD 2;\r
+ result := result DIV 2;\r
+ END;\r
+ IF resto = 1 THEN binario := binario + '1'\r
+ ELSE binario := binario + '0';\r
+ IF result = 1 THEN binario := binario + '1'\r
+ ELSE binario := binario + '0';\r
+ writeln('');\r
+ write('El numero es: ');\r
+ FOR i := length(binario) DOWNTO 1 DO write(binario[i]);\r
+ writeln('');\r
+ writeln('');\r
+ writeln('');\r
+ write('Ingrese otro numero (-1 para terminar): ');\r
+ readln(numero);\r
+ END;\r
+ writeln('');\r
+ writeln('Fin del Programa.');\r
+END.\r
--- /dev/null
+program PEDORRO1;\r
+\r
+var\r
+ num, suma: integer; (* num: numero ingresado/ suma: suma de numeros ingresados *)\r
+ negativo: boolean; (* flag que se activa cuando se ingresa un negativo *)\r
+\r
+begin\r
+ negativo := false;\r
+ suma := 0;\r
+ write ('Ingrese un n£mero entero (-1 para terminar): ');\r
+ readln (num);\r
+ while num <> -1 do\r
+ begin\r
+ suma := suma + num;\r
+ if num < 0\r
+ then negativo := true;\r
+ write ('Ingrese otro n£mero entero (-1 para terminar: ');\r
+ readln (num);\r
+ end;\r
+ write ('La suma es ', suma);\r
+ if negativo\r
+ then writeln (' y se ingresaron valores negativos.')\r
+ else writeln (' y no se ingresaron valores negativos.');\r
+end.\r
+\r
+\r
--- /dev/null
+PROGRAM NumeroPi;\r
+\r
+VAR\r
+ pi: real;\r
+ i, n: integer;\r
+\r
+BEGIN\r
+ pi := 0;\r
+ write( 'Ingrese el n£mero de t\82rminos a tomar para calcular PI: ' );\r
+ readln( n );\r
+ FOR i := 0 TO n DO IF ( i MOD 2 ) = 0 THEN pi := pi + ( 4 / ( ( 2 * i ) + 1 ) )\r
+ ELSE pi := pi - ( 4 / ( ( 2 * i ) + 1 ) );\r
+ writeln( 'PI = ' , pi : 12 : 11 , ' PI = ' , 4 * arctan( 1 ) : 40 : 39 );\r
+END.\r
--- /dev/null
+program potencia;\r
+\r
+function pot(base, exp: integer): integer;\r
+\r
+begin\r
+ if exp > 0 then pot := base * pot(base, exp - 1)\r
+ else pot := 1;\r
+end;\r
+\r
+var\r
+ i: integer;\r
+ cadena: string[4];\r
+\r
+begin\r
+ writeln (' 2 a la 4 es: ', pot(2,4));\r
+ writeln (' 3 al cubo es: ', pot(3,3));\r
+ cadena := 'Luca';\r
+ for i := 0 to 3 do if cadena[i+1] = 'a' then writeln('letra ', i+1, ' = ', pot(2,i));\r
+end.\r
--- /dev/null
+(******************************************************************)\r
+(* *)\r
+(* Programa que pregunta por un n£mero y dice si es o no primo. *)\r
+(* *)\r
+(******************************************************************)\r
+\r
+program PRIMOS1;\r
+\r
+var\r
+ num: integer; (* Entrada de usuario *)\r
+ raiz_trunc: integer; (* Almacenamiento de la raiz cuadrada de num truncada *)\r
+ i: integer; (* Contador *)\r
+ es_primo: boolean; (* Flag para ver si es primo o no *)\r
+\r
+begin\r
+\r
+es_primo := true;\r
+\r
+ write('Ingrese el n£mero entero que desea ver si es primo o no: ');\r
+ readln(num);\r
+ raiz_trunc := trunc(sqrt(abs(num)));\r
+ for i := 2 to raiz_trunc do\r
+ begin\r
+ if (num mod i) = 0 then\r
+ begin\r
+ writeln('No es primo, es divisible por ', i, '.');\r
+ es_primo := false;\r
+ end;\r
+ end;\r
+ if es_primo then writeln('El n£mero ingresado es primo.');\r
+end.\r
+\r
--- /dev/null
+Computing Course\r
+AlgorithmQuick Sort\r
+ Implemented in : Turbo Pascal 6.0\r
+ DescriptionQuick sorts 1000 items and times how long it takes.\r
+ \r
+Explanation\r
+\r
+\r
+\r
+program qsort;\r
+uses crt,dos;\r
+const\r
+max = 1000;\r
+type\r
+list = array[1..max] of integer;\r
+var\r
+data : list;\r
+i : integer;\r
+h,m,s,hun : word;\r
+procedure quicksort(var a : list; Lo,Hi: integer);\r
+procedure sort(l,r : integer);\r
+var\r
+i,j,x,y : integer;\r
+begin\r
+i := l; j := r; x := a[( l+r ) div 2];\r
+repeat\r
+while a[i] < x do i := i+1;\r
+while x < a[j] do j := j-1;\r
+if i < j then\r
+begin\r
+y := a[i]; a[i] := a[j]; a[j] := y;\r
+i := i+1; j := j-1;\r
+end;\r
+until i > j;\r
+if l < j then sort( l , j );\r
+if i < r then sort( i , r );\r
+end;\r
+begin {quicksort};\r
+sort( Lo , Hi );\r
+end;\r
+begin {qsort};\r
+write('Now generating 1000 random numbers...');\r
+randomize;\r
+for i := 1 to max do data[i] := random(30000);\r
+writeln;\r
+writeln('Now sorting random numbers...');\r
+gettime(h,m,s,hun);\r
+writeln('Start time is : ',h,' : ',m,' : ',s,' : ',hun);\r
+quicksort( data, 1, max );\r
+writeln;\r
+{for i := 1 to max do write(data[i] ); }\r
+gettime(h,m,s,hun);\r
+writeln('Finish time is : ',h,' : ',m,' : ',s,' : ',hun);\r
+end.\r
+\r
+\r
+\r
+Explanation : Quick Sort\r
+Start at "begin {qsort}" ( last paragraph)\r
+Generate 1000 random numbers and say so.\r
+Get the current time and display it.\r
+Jump to "quicksort" procedure with the variables (data - the array), (1 - the \r
+start position), and (max - the last position).\r
+At quicksort data changes to the variable a, 1 to Lo and max to Hi. (so data,1, \r
+max ..... goto .....a, Lo, Hi )\r
+Now jump down to begin "{quicksort}" (This is the start of the main procedure)\r
+This calls the procedure "sort" with the variables Lo and Hi.\r
+Which then become l and r (left and right) (Don't ask me why!!! I think it's to \r
+tell the different procedure's own variables appart from each other, a bit \r
+confusing really)\r
+So we now have l=1 and r=1000...(the first and last positions of the array)\r
+Now we need to keep l and r for later so we create i and j to use within the \r
+procedure and assign them the same values as l and r.\r
+x takes on the value of the item in the middle of the array ie. with a list of \r
+7,4,6... x would be 4. ( this sets the pivot value around which the program will \r
+sort left and right. ie. <list of no's on L><pivot val><list of no's on R>\r
+Ok so now we should have the hi, lo and middle values to sort. \r
+Now we're on the two while loops...\r
+The first says increment i until the value contained in position i is greater \r
+than the value pointed at by x (the middle value).\r
+Simerly the second lowers the value of j until the value of position j is lower \r
+than the value of the middle item.\r
+If the items pointed at have not crossed the middle value... Ie both pointers i \r
+and j are still on the side of the array they started on then swap the values \r
+contained in those two positions. And move both i and j pointers one towards the \r
+middle.\r
+End of the if bit.\r
+We have to repeat the testing and swapping section until everything greater than \r
+the middle value is on the right of it and everything lower than the middle \r
+value is on the left of it. This means that if the value of the middle position \r
+has not got an equal amount of higher and lower numbers in the array the value \r
+of the middle position will change addresses in the array, but it will still be \r
+the pivot or middle value...\r
+I think this needs an example...\r
+0,1,2,3,7,4,5,6,8,9 - array a.\r
+x = 1+10 div 2 = 5.....So the value of "the middle value" is \r
+7.....a[5]=7...........Hope you're getting this.\r
+now we test l against x...(0-7 no change necessary) (1-7..no change) (2-7..no \r
+change) (3-7..no change) (7-7..stop) i now equils 5..( ie a[5]=7 )\r
+and now r against x..(7-9..no change) (7-8..nochange) (7-6..stop) j now equils \r
+8..( ie a[8]=6 )\r
+Swap 7 and 6 over (using a temporary value y) leaving 0,1,2,3,6,4,5,7,8,9....x \r
+now equils 8..\r
+The middle value will always be 7 this pass. (ie x=8 ... a[8]=7 .. a[x]=7 )\r
+As you can see now all higher numbers are to the right of 7 and all lower \r
+nimbers to the left of 7.\r
+Here we can say 7 is in the sorted place and can be left alone now. \r
+We seperate the left side of the list and call the sort procedure again passing \r
+in the parameters to say that the array only exists between positions 1 and 7 ie \r
+l=1 and r=7... \r
+This will continue findind a middle value and putting it in the right place \r
+until all values have been the middle value ie lists of size one. it will go \r
+down the left hand side of the array splitting it like it was a binary tree. \r
+Once all Left hand options have been sorted the right hand options will be delt \r
+with.\r
+Furthur example...\r
+list a is 5,3,9,4,2 ... x=3 , l=1 , r=5....swap 9 and 2..\r
+5,3,2,4,9 ... x=5 , l=1 , r=5....split off left\r
+5,3,2,4 ... x=2 , l=1 , r=4....swap 5 and 2..\r
+So far ... 2,3,5,4,9 ... processed -9,3\r
+2,3,5,4... x=2 , l=1 , r=4....split off left\r
+2... x=1 , l=1 , r=1.... split off right\r
+So far ... 2,3,5,4,9 ... processed -9,3,2\r
+5,4 ... x=3 , l=3 , r=4....swap 5 and 4\r
+4,5 ... x=4 , l=3 , r=4...split off left\r
+So far ... 2,3,4,5,9 ... processed -9,3,2,5\r
+4 ... x=4 , l=4 , r=4....stop\r
+So far ... 2,3,4,5,9 ... processed -9,3,2,5,4\r
+or\r
+positions... 1,2,3 \r
+sort 1,2,3\r
+Pos 2 sorted\r
+sort 1\r
+pos 1 sorted\r
+sort 3 \r
+pos 3 sorted\r
+I think the key to this is realising that the array is split into unequil halves \r
+each pass around... recursivly the lefthand side is called with one set of \r
+parameters and then the righthand side is called with the opposing set of \r
+parameters.\r
+If you need any furthur help with this don't hesitate in contacting me... I'll \r
+try to help.\r
--- /dev/null
+PROGRAM NumeroPi;\r
+\r
+VAR\r
+ a, b, c, xre, xim: real;\r
+\r
+BEGIN\r
+ xim := -1;\r
+ xre := -1;\r
+ writeln( ' 2' );\r
+ writeln( ' aX + bX + c = 0' );\r
+ write( 'Ingrese a: ' );\r
+ readln( a );\r
+ write( 'Ingrese b: ' );\r
+ readln( b );\r
+ write( 'Ingrese c: ' );\r
+ readln( c );\r
+ IF ( sqr( b ) - 4 * a * c ) < 0 THEN xim := abs( sqr( b ) - 4 * a * c ) / ( 2 * a )\r
+ ELSE xre := ( sqr( b ) - 4 * a * c ) / ( 2 * a );\r
+ IF xre <> -1 THEN writeln( 'X1 = ' , ( ( -b ) / ( 2 * a ) ) + xre : 3 : 2 , ' X2 = ' , ( ( -b ) / ( 2* a ) ) - xre : 3 : 2 )\r
+ ELSE IF xim <> -1 THEN writeln( 'X1 = ' , ( -b ) / ( 2 * a ) : 3 : 2 , ' + ' , xim : 3 : 2 , 'i X2 = ' , ( -b ) / ( 2* a ) : 3 : 2 , ' - ' , xim : 3 : 2 , 'i' )\r
+ ELSE writeln( 'Hubo un error.' );\r
+END.\r
--- /dev/null
+program selection_demo(input,output);
+ const
+ MAX = 10;
+ var
+ a : array[1..MAX] of integer;
+ i, n : integer;
+
+ procedure swap(var a,b : integer);
+ var
+ temp : integer;
+ begin
+ temp := a;
+ a := b;
+ b := temp;
+ end;
+
+ procedure selection_sort;
+ var
+ i : integer;
+ max : integer;
+ top : integer;
+ begin
+ for top := n downto 2 do
+ begin
+ max := top;
+ for i := 1 to top-1 do
+ if a[i] > a[max] then
+ max := i;
+ swap(a[top],a[max])
+ end
+ end;
+
+ begin { main }
+ writeln('How many number would you like to sort (max=',MAX:2,') ?');
+ readln(n);
+
+ writeln('Enter in ',n:1,' numbers:');
+ for i := 1 to n do
+ read(a[i]);
+
+ selection_sort;
+
+ for i := 1 to n do
+ write(a[i]:1,' ');
+ writeln
+
+ end.
+
--- /dev/null
+Selection Sort\r
+Selection Sort is an elementary sorting algorithm that is designed to minimize \r
+the number of exchanges that are performed. \r
+It works by making N-1 passes over the unsorted portion of the array, each time \r
+selecting the largest value. This value is then moved into its final sorted \r
+position with a single exchange. \r
+Here is a procedure that implements Selection Sort, assuming a global array a[ ] \r
+with n elements, and a procedure called swap( ). \r
+\r
+ \r
+\r
+procedure selection_sort;\r
+ var\r
+ i : integer;\r
+ top : integer;\r
+ max : integer;\r
+ begin\r
+ for top := n downto 2 do\r
+ begin\r
+ max := top;\r
+ for i := 1 to top-1 do\r
+ if a[i] > a[max] then\r
+ max := i;\r
+ swap(a[top],a[max])\r
+ end\r
+ end;\r
+\r
+ \r
+ DOWNLOAD selection.pas (complete program) \r
+Selection Sort requires about N2/2 comparisons and about N exchanges, and is \r
+quite insensitive to the original ordering of the input data. \r
+\r
+\r
+\r
--- /dev/null
+PROGRAM cadenas;\r
+\r
+VAR cadena: string[40];\r
+ i: integer;\r
+\r
+BEGIN\r
+ cadena := 'Luca';\r
+ writeln(' Cadena: ', cadena, ' Caracteres: ', length(cadena));\r
+ for i := length(cadena) downto 1 DO write(cadena[i]);\r
+{ write(cadena[0]);\r
+ write('lucaman'); }\r
+END.\r
--- /dev/null
+program nombre_programa;\r
+\r
+const\r
+\r
+var\r
+\r
+begin\r
+\r
+end.\r
--- /dev/null
+/* Weiss used 1-n as the indices of the array rather than 0 to n-1 Also, he \r
+modified the Ada version quite a bit so that it would "work" in C. In the Ada \r
+version he used "and then" to force what is called short- circuit evaluation. \r
+All C comparisons use short-circuit evaluation so the algorithm did NOT need to \r
+be changed. */ \r
+\r
+#include <stdio.h>\r
+\r
+void shellsort(int a[], int n)\r
+{\r
+ int i, j, increment;\r
+ int temp;\r
+ \r
+ for (increment = n/2; increment > 0; increment /= 2)\r
+ {\r
+ for (i = increment; i < n; i++) /*changed this line*/\r
+ {\r
+ temp = a[i];\r
+ j = i; \r
+ while ((j>=increment)&&(temp<a[j-increment]))\r
+ {\r
+ a[j] = a[j-increment];\r
+ j -= increment;\r
+ }\r
+ a[j] = temp;\r
+ }\r
+ }\r
+}\r
+\r
+void print(int a[], int high)\r
+{\r
+ int i;\r
+ for (i = 0; i < high; i++)\r
+ {\r
+ printf("%d ",a[i]);\r
+ }\r
+}\r
+\r
+void main(void)\r
+{\r
+ int array[13]={81, 94, 11, 96, 12, 35, 17, 95, 28, 58, 41, 75, 15};\r
+\r
+ shellsort(array, 13);\r
+ print(array,13);\r
+}\r
+\r
+\r